Novak Djokovic staved off a huge upset and Rafael Nadal was made to battle in their opening matches at the Madrid Masters on Wednesday.
In his first outing since splitting with his long-time coaching team Djokovic had to dig deep before eventually despatching Nicolas Almagro 6-1, 4-6, 7-5 in his second round tie.
Nadal was also taken to three sets before seeing off Fabio Fognini.
Djokovic arrived in the Spanish capital without a coach after bringing to an end a 10-year relationship with Marian Vajda in an attempt to reverse his dramatic slump in form over the past year.
And after a blistering start, Djokovic had to battle back from 3-0 down in the deciding set to book his place in the last 16 on Thursday against Feliciano Lopez, who beat Gilles Simon 6-3, 3-6, 7-6 (7/3).
"I'm still finding my way to that consistency level and quality of tennis that I'm looking for," said Djokovic.
"I'm aware that I'm not playing at my best, but I'm definitely believing in myself and the process.
"Eventually the game will come together."
The early signs were positive for the 12-time Grand Slam champion as despite losing his service in the opening game, he broke straight back to start a six-game streak to romp through the first set.
Almagro had taken just one set from four previous meetings with Djokovic, but willed on by a partisan home crowd, he held on to his serve despite more pressure from the Serb in the first game of the second set.
The Spaniard had to save two break points to hold for 4-3 and then took his chance to break with Djokovic serving to stay in the set.
The world number 75, who dipped down to the challenger tour after losing in the first round of the Australian Open earlier this year, then looked set for a monumental upset as he raced into a 3-0 lead in the decider.
However, a mixture of Almagro nerves and Djokovic upping his intensity saw the world number two react immediately to level at 3-3.
More Almagro errors flowed to give Djokovic another break for 6-5 and he served out for the match.
"Four consecutive games lost in this level should not happen because otherwise you're going to lose the match," added Djokovic.
"I was very close to losing it, as well. He was up 3-love.
"I'm happy with the way I handled the pressure in those moments, just stayed with him, made him play always extra shot.
"I did my work in the end of the match."
Djokovic could meet Nadal in the semi-finals.
The home favourite needed 90 minutes to complete the opening set, finally finishing off Italian Fognini 7-6 (7/3), 3-6, 6-4 on a second match point after being broken while serving for victory.
Nadal improved to 9-3 against Fognini and has now won 11 straight matches this season; he is fresh from 10th career clay titles in Monte Carlo and Barcelona.
The 14-time Grand Slam champion now faces Nick Kyrgios in the third round.
Controversial Australian Kyrgios cruised past American Ryan Harrison 6-3, 6-3.
Fifth seed Milos Raonic is also into the last 16 as he got the better of a battle between two big servers 6-4, 6-4 over Gilles Muller.
Raonic will play Belgium's David Goffin next.
Kei Nishikori recovered from a dreadful start to beat Argentine Diego Schwartzman 1-6, 6-0, 6-4.
Nishikori faces David Ferrer next, who progressed as Jo-Wilfried Tsonga withdrew with a shoulder injury.
In the WTA Madrid Open, holder Simona Halep advanced over 16th seed Samantha Stosur 6-4, 4-6, 6-4.
Svetlana Kuznetsova remained one of only three of the top 10 seeds left in the draw with a 6-4, 7-5 win over Wang Qiang to reach the quarter-finals.
Kuznetsova will face the winner of an intriguing clash between top seed Angelique Kerber and Eugenie Bouchard, who dumped out Maria Sharapova in thrilling fashion on Monday.