"I played really good tennis against Andy, but of course it's hard because he's number one in the world and I was 6-2 5-1 up but I was thinking the match might go on because you never know with him", Fognini, who struck 23 forehand winners during the victory, told Sky Sports.
Murray, who turned 30 on Monday, has not won a title since the Dubai Open in February and was eliminated in the second round of the Madrid Open last week, and his defence of the Rome Masters has now ended at the first hurdle.
Murray has won just one tournament this year and Fognini was in no mood to come bearing late birthday gifts, outclassing the defending champion to win 6-2 6-4.
Fognini, though, maintained his dominance to serve out victory and secure a first win over a world No 1 and will next face the victor of the clash between Alexander Zverev and Viktor Troicki. The Scot did threaten a comeback when reducing the second-set score to 5-4, but the Italian served the match out at the second time of asking.
The home favourite was able to hold off a Murray fightback to secure a 6-2, 6-4 victory.
Earlier, four-time champion Novak Djokovic overcame a challenging first set to beat British qualifier Aljaz Bedene 7-6 (7-2) 6-2 in his opening match.
Ambulances diverted to North Mid Hospital following crippling cyber attack
"This means that security fixes are no longer produced, leaving systems exposed to common types of cyber-attack". And experts say the scope of the problem could expand as people return to work and fire up their computers.
Berdych is a century of victories adrift of Ferrer after the 31-year-old Czech ousted qualifier Berlocq in straight sets.
Djokovic dominated the early exchanges to race into a 5-0 lead before Bedene finally got on the board with a powerful forehand but he could not prevent the Serbian from winning the first set.
David Goffin, Marin Cilic and John Isner were also among the winners in the Italian capital.
Sharapova was leading Mirjana Lucic-Baroni 4-6, 6-3, 2-1 when she called it quits on Tuesday in the second round.
Elsewhere in Tuesday's first-round matches, number 13 seed Jack Sock came through 6-4 1-6 7-5 against Argentina's Diego Sebastian Schwartzman.
Benoit Paire set up a clash against Swiss third seed Stan Wawrinka after he beat fellow Frenchman Nicolas Mahut 6-3 6-4.