Andy Murray flirted with disaster in the desert for a third straight year before seeing off Russia's Evgeny Donskoy at Indian Wells.
The Briton had suffered surprise losses on his last two visits to the BNP Paribas Open but battled past the world number 83, 5-7 6-2 6-2.
It was Murray's first match since he in the Australian Open final on 27 January.
World number one Novak Djokovic beat Italy's Fabio Fognini 6-0 5-7 6-2.
Djokovic and Murray both received byes in the first round and are seeded to meet in the semi-finals, with the Scot up against Taipei's Yen-Hsun Lu in round three.
Murray had spent much of his time since Australia training in Miami, and had vowed to improve on recent performances in Indian Wells, but he found it hard going at the outset.
Whether it was the combination of slow courts and high altitude, or simply an opponent in form, the world number three could not find any rhythm as he endured a dreadful opening 25 minutes.
A poor drop shot gave up the break in game three, two break points disappeared with flashing forehands from Donskoy in game four, and the double-break was handed over to love in game six.
At 5-1 down the set was apparently gone, but Murray stemmed the flow with a break and a hold, and when he got back on level terms it looked as though the danger had passed.
Donskoy had plenty more to offer, however, fending off six break points in an 11-minute game at 5-5 and riding the wave of confidence that gave him to break for a third time and deservedly clinch the set.
Murray had looked edgy from the start and, given his recent history in the Californian desert, might have been especially vulnerable from a set down, but the US Open champion calmly worked his way back into the contest.
Some solid serving gave him a foothold and Donskoy finally faltered when he blasted a forehand volley wide to slip a break down at 3-2.
Murray ran away with it from then on, winning 11 of the last 13 games and finding a couple of winning drops shots to come back from 0-40 and serve out after two hours and 17 minutes.
"I've struggled here the past couple of years, I haven't won a match," said the 25-year-old Scotsman. "I was a little bit nervous in the beginning and he started very, very well, he came up with some unbelievable shots. I just tried to hang in there and was hitting the ball much better by the second set.
"Once I got into more of a rhythm I was able to dictate more of the points."
Meanwhile, top seed Djokovic also had his problems against 25-year-old Fognini, the world number 36.
Djokovic took the first set in a mere 19 minutes, but the feisty Fognini came back to force a deciding set after the Serb squandered one match point in the 10th game and was broken in the 11th when he netted a forehand.
Breaks in the fourth and eighth games secured Djokovic's fourth win in four against Fognini and gave him a 14-0 record in his matches this year.
"I had a very bad game at 4-2, made a couple of unforced errors, got him back in the match. Next thing you know we're one set all and a couple of tight games. I'm just happy to get through," Djokovic said.
In the women's draw, second seed and 2006 champion Maria Sharapova was tested in her third-round match before defeating Carla Suarez Navarro of Spain 7-5 6-3.
The Russian squandered an early break in the first set before breaking again in the 11th game and then fended off break point before closing out the opener in 58 minutes.
Sharapova saved two break points in the second game of the second set before taking control and reeling off four straight games from 3-2 down to claim victory in one hour and 40 minutes.
Sixth seed Sara Errani cruised into the fourth round, dismissing Sweden's Johanna Larsson 6-3 6-1 in 81 minutes.