Novak Djokovic was severely tested before securing a 6-3, 4-6, 6-4 win over Philipp Kohlschreiber to survive his opening match at the Monte Carlo Masters on Tuesday.
The winner of the last three grand slams tournaments made eight double faults, dropped serve four times and smashed a racquet after losing the second set to his German opponent in the second-round encounter.
The world No 1 was relieved to avoid defeat in his first match of the clay season.
"It was a difficult match, there were lots of breaks [a run of eight straight during the second and third sets]," Djokovic said. "There were lots of ups and downs. It was not the prettiest of matches.
"He played well, but a win is a win. This was a tough first match of the clay season.
"I had to figure out how I needed to move, this kind of match can be expected. It was probably good for me to spend so long on the court."
Djokovic was able to avoid a second straight loss to Kohlschreiber after the 35-year-old beat him last month in the Indian Wells third round.
Djokovic, who lives in the Principality, is playing his 'home' event for the 13th time in 14 years, winning it in 2013 and 2015 and losing in the final on two other occasions.
Kohlschreiber lost his 12th match from 13 played against top-ranked opponents, but gave as good as he got against an out-of-sorts Djokovic, who needed five match points to go through.
Pella pounds Cilic
Argentine Guido Pella dealt a second-round blow to seventh seed Marin Cilic, beating the Croatian 6-3, 5-7, 6-1.
Defeat in just over two hours left 2014 US Open winner Cilic with just one win from six matches since January's Australian Open, where he went out in the fourth round.
Pella, who won his first career match at the event in the first round on Sunday, emerged a winner as he played on the idyllic centre court for the first time.
"This is my best surface, I knew I had chances," the world No 35 said. "But I had to play well.
"I was a bit nervous at the start, it was my first time on this court. But playing here is a dream - it's unreal."
Cilic was playing here for the 11th straight year, with quarter-final showings in three of the previous four editions.
Left-hander Pella came to the European clay with a title this season in Sao Paulo. He now stands 13-3 on the surface in 2019.
Pella moved into a winning position as he broke Cilic for the eighth time of the afternoon, winning a six-minute game before serving out the upset, saving a break point in the final game and wrapping up victory as Cilic fired wide.
In the first round, Briton Cameron Norrie advanced in his debut match at the event, with the 23-year-old defeating Adrian Mannarino 6-4, 6-3.
The 56th-ranked Norrie was impressed with the dramatic setting of the iconic Monte Carlo Country Club venue which overlooks the Mediterranean from a cliff.
"I like the conditions here. Everything is kind of on top of each other," he said. "It's pretty sick kind of playing tennis on the side of a mountain with a water view."
Canadian revelation Felix Auger-Aliassime advanced into a second-round contest with third seed Alexander Zverev after beating Argentine qualifier Juan Ignacio Londero 7-5, 7-6.
The 18-year-old Auger-Aliassime, who reached last month's Miami semi-finals as a qualifier, now boasts a ranking of 33rd - up from 175th when he played here a year ago.
"I'm very happy to win my first match after Miami, because I didn't know what to expect," he said.
Italian qualifier Lorenzo Sonego beat Russian eighth seed Karen Khachanov 7-6, 6-4.