The world number one has struggled for form in 2017 and it became apparent that he faced a fight to progress further at Roland Garros when he dropped the opening set to the left-hander.
However, after breezing through sets two and three and battling back from a break behind in the fourth, the 30-year-old eventually advanced by a 6-7 6-2 6-2 7-6 scoreline to set up a mouthwatering clash with Juan Martin del Potro.
Compatriot Kyle Edmund was able to join Murray in the last 32 as he made light work of Renzo Olivo , who defeated Jo-Wilfried Tsonga in the opening round.
Edmund had never been past the second round in Paris, but he ensured that he improved on his previous best effort with a 7-5 6-3 6-1 win.
The 22-year-old will now play South Africa’s Kevin Anderson, who came through a four-set tussle with Nick Kyrgios.