Julian Reese led the Terrapins with 17 points and nine rebounds and Hakim Hart added 15, including the go-ahead basket to go along with four rebounds and three assists.
West Virginia was paced by Kedrian Johnson, who poured in a career-high 27 points, but missed the game-winning three-pointer as time expired.
Maryland (22-12) has now won 15 of their last 16 first-round Tournament games and moves on to face top seed Alabama while the Mountaineers finish their season at 19-15.
"We were a little careless with the ball and they made shots", West Virginia coach Bob Huggins said. "They started backing us in. We didn't match up very well with them when they started backing us in. It wasn't a good matchup for us."
Maryland overcomes hot West Virginia start to lead at half
West Virginia came out hot, grabbing an early 16-4 lead and increasing it to 19-6 on a corner three by Joe Toussaint. A 7-0 run by Maryland drew them to within six.
The deficit was cut even further as Patrick Emilien converted on a three-point play to make it a 21-19 game and a triple by Jahmir Young gave the Terrapins their first lead of the game.
Kevin Willard's club finished the opening 20 minutes hot from the floor, making nine of their final 13 shots to take a 32-30 lead into halftime.
Terps go in front in seesaw affair
After a three by Don Carey extended Maryland's advantage to 37-31, West Virginia went on a 16-0 run as Johnson took over, scoring 13 points in that stretch to go up 47-38 with 12:55 to play.
A layup by Tre Mitchell put the Mountaineers in front 51-43, but owing to the back-and-forth nature of the contest, the Terrapins again responded with a 9-0 run, a basket by Hart capping it off.
West Virginia was in foul trouble as the game wore on with Jimmy Bell Jr. fouling out and James Okonkwo playing with four. Mohamed Wague, the team's best shot-blocker, was lost for the season with a leg injury.
Erik Stevenson and Donta Scott exchanged threes to make it a 59-59 game and after the ball bounced back and forth between both teams, Hart finished with a dunk to put Maryland ahead for good.
Johnson misses game-winner at buzzer as Maryland survives
Reese's dunk increased the lead to 64-59, but missed free throws left the door open and Mitchell's bucket cut the deficit to 66-65. Young was fouled with 4.7 seconds to play, making one of two to set up the final sequence.
After inbounding the ball to Johnson, he ran it upcourt, but he could only manage a running three from the far side of the court by the NCAA logo that bounced off the rim.