Federer has never won the Rome Masters event
World number one Roger Federer made the worst start possible to his clay-court season as he lost to Ernests Gulbis in round two of the Rome Masters.
An out-of-sorts Federer took the first set 6-2 only for his Latvian rival, 21, to force his way back into the match.
A nervy Gulbis, who is ranked 40th in the world, needed seven match points to seal a stunning 2-6 6-1 7-5 victory.
World number two Novak Djokovic beat France's Jeremy Chardy 6-1 6-1 to seal his place in the third round.
Djokovic, champion in 2008 and runner-up in 2009, dismissed 46th-ranked Chardy in less than an hour, and was later joined in the
next round by world number five Andy Murray.
Reigning champion Rafael Nadal of Spain will face Germany's Philipp Kohlschreiber on Wednesday.
Federer collected his 16th Grand Slam title at the Australian Open in January but has made early exits in Miami and Indian Wells before his Rome reverse.
The 28-year-old Swiss, who is still in the doubles in Italy, is scheduled to play in Estoril and Madrid before beginning the defence of his French Open title in May.
Federer had looked destined for a fairly straightforward early on against Gulbis, taking advantage of his opponent's inconsistent play to cruise through the opening set.
But the reigning French Open and Wimbledon champion began to falter in the second, with Gulbis winning it 6-1 before finally coming through in a gripping decider.
Federer struggled in the damp conditions, committing 38 unforced errors and making only 46% of first serves.
Still, Gulbis looked to have blown his chance of victory when, after missing two match points at 5-3 in the final set, he served for the match at 5-4 and saw four more chances come and go.
But he was handed another opportunity to serve for victory, following another error-strewn game from Federer, and did so to love.
Gulbis described his win as "the best of my career", adding: "I was scared to beat him. My whole body is shaking. I cannot believe I won."