The Spaniard had caused an upset when he defeated the world number one in the third round in Monte-Carlo last week, and he looked poised for a repeat.
But Ramos-Vinolas missed a chance to serve for the match and it was Murray who came through after two hours and 59 minutes.
Image credit: Getty Images
Frustrated Murray loses out to top seed Hurkacz at ATP Metz
Murray, who has never reached the final in Barcelona, was forced to dig deep after being broken twice in an error-strewn first set, where his first-serve percentage was down at 35%.
The 29-year-old then saved three break points in the ninth game of the second set before taking it to a decider after capitalising on his first break-point opportunity in the 10th.
After both dropping serve early in the final set, world number 19 Ramos-Vinolas had the chance to serve for the match after breaking the Scot in the ninth game, but Murray showed his mettle to break back immediately and take it to 5-5.
A tie-break soon followed, and Murray raced to a 4-0 lead before clinching it 7-4.
Murray will now face Dominic Thiem for a place in the final after the Austrian fourth seed cruised past Japanese world number 91 Yuichi Sugita 6-1 6-2 to reach the last four.
Defending champion Rafael Nadal’s was made to work against South Korean 20-year-old Hyeon Chung, but prevailed 7-6(1) 6-2 to reach the semis.
Standing in between Nadal and a final spot is Horacio Zeballos, who comfortably beat Karen Khachanov 6-4 6-1 in the late game.
Nadal is chasing his 10th title in Barcelona as he gears up for the French Open, where he has not won since 2014.
Dominic Thiem (Aut) beat Yuichi Sugita (Jpn) 6-1 6-2
Andy Murray (Gbr) beat Albert Ramos-Vinolas (Spa) 2-6 6-4 7-6
Rafael Nadal (Spa) beat Hyeon Chung (Kor) 7-6(1) 6-2
Horacio Zeballos (Arg) beat Karen Khachanov (Rus) 6-4 6-1
'My tennis is getting better' - Murray feeling good as he sets up Moselle Open quarter-final
Murray disposes of Pospisil to reach Metz quarter-finals