Andy Murray gained revenge on Spain’s Albert Ramos-Vinolas but was pushed all the way in a gruelling three-hour encounter 2-6, 6-4, 7-6 (7-4) to make the Barcelona Open semi-finals on Friday.

Ramos-Vinolas beat the world No 1 on Murray’s return from an elbow injury in the third round of the Monte Carlo Masters last week.

He threatened to repeat that upset when he served for the match in the third set.

However, Murray, who accepted a late wildcard to the event in the Catalan capital to gain match practice ahead of next month’s French Open, battled back to edge out the world No 19 in a final set tiebreak.

“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 because it was very tough.”

Ramos-Vinolas is in the form of his life having risen to a career high ranking after reaching the final in Monte Carlo and he dominated the opening stages, taking five straight games after Murray started with a comfortable hold.

Murray edged the second with the only break in the 10th game.

The Scot, though, failed to build on that momentum as he was broken in the first game of the third set.

However, Ramos-Vinolas had to take an injury timeout after twisting his ankle when leading 2-1 and Murray pounced to break back at 2-2.

Ramos-Vinolas had the chance to serve it out when he broke again for 5-4, but nerves seemed to get the better of him as three errors handed Murray the break back.

Murray raced out to a 4-0 lead in the tiebreak and saw it out as Ramos-Vinolas’s efforts over the past two weeks finally began to take their toll.

The Wimbledon champion faces Dominic Thiem in Saturday’s semis after the Austrian ended Japanese lucky loser Yuichi Sugita’s unlikely run to the quarters 6-1, 6-2.

Sugita lost in qualifying and was only handed a place in the main draw after compatriot Kei Nishikori’s late withdrawal with a wrist injury.

Thiem had far too much quality for the world number 91 as the Austrian wrapped up victory in under an hour on court.

Rafael Nadal’s quest for a 10th Barcelona title also continues in Friday’s quarter-finals when he faces Korean qualifier Chung Hyeon.

Results:

Quarter-finals:

Dominic Thiem (AUT x4) bt Yuichi Sugita (JPN) 6-1, 6-2

Andy Murray (GBR x1) Albert Ramos-Vinolas (ESP x10) 2-6, 6-4, 7-6 (7-4)