The Scot dug deep to claim a 2-6 6-4 7-6 (7-4) victory in a match that lasted two hours 59 minutes.
He recovered from two breaks of serve in the third set, his opponent serving for the match at one point.
Murray now faces Austria's Dominic Thiem in the last four.
Ramos-Vinolas, who is at a career-high world ranking of 19, capitalised on a string of unforced Murray errors to take the first set but was pinned back in the second as the Scot battled back to level.
In Monte Carlo, Murray had led 4-0 in the final set before capitulating to a defeat to Ramos-Vinolas.
In Barcelona, it was the Spaniard who held a final set lead, winning the first two games before injuring his foot attempting to receive a volleyed return, which led to a lengthy period of treatment.
The incident initially benefited Murray, who won the next three games, but Ramos-Vinolas steadied the ship and looked set for victory after breaking in the ninth game.
However, Murray dug deep and immediately broke back before taking the match to a tie-break that he largely dominated and clinched on his second match point.
"It was obviously a very tough match," said Murray. "It was kind of the opposite of the match we had last week where probably  today he deserved to win. He created a lot more chances, he served for the match and couldn't quite get it.
"Last week I had 4-0 [in the third set], I felt like I had all of the  chances. Sometimes on clay matches happen this way, so very happy to get through."
Rafael Nadal, a 10-time winner in Barcelona, joined Murray in the last four courtesy of a 7-6 (7-1) 6-2 win over Korean qualifier Hyeon Chung.
The Spanish 14-time Grand Slam champion, 30, takes on Russia's Karen Khachanov or Argentine Horacio Zeballos in the last four.
Britain's Aljaz Bedene continued his winning run with a straight-sets win over second seed Ivo Karlovic to reach the Hungarian Open semi-finals.
British number four Bedene broke the Croat's serve early in both sets on his way to a 6-4 6-3 victory, and a 15th-straight win.
The 27-year-old, ranked outside the top 100 at the beginning of March, has climbed to world number 68.
He faces fourth seed Fernando Verdasco or fellow qualifier Laslo Djere next.
Bedene came through qualifying in Budapest to reach his first ATP Tour semi-final since January 2016.
He also won back-to-back titles on the second-tier ATP Challenger Tour earlier this month.
The clay court specialist has now won 22 of his past 23 matches, with the only defeat coming on hard courts at the Miami Masters.
World number one Andy Murray gained revenge for last Thursday's defeat by Albert Ramos-Vinolas in Monte Carlo by beating the Spaniard to reach the last four of the Barcelona Open.