Fognini triumphed 6-3, 6-3, 6-4 in the clash between the countries' top players to keep alive Italy's bid to reach the semifinals for the first time in 16 years.
"Today I just played better than Andy and that's tennis," Fognini said. "Andy played one-and-a-half matches yesterday. I just tried to do my best. Today it was important for me to beat a player who has won everything.
"The crowd especially in Davis Cup is difficult. I'm really happy for this point. I was annoyed yesterday after the doubles. This was a very important victory, it's certainly my best match in Davis Cup. I just stayed focused on my game and I managed to win."
The final break came in the final game when the eighth-ranked Murray rescued two match points but hit a third into the net.
"He played very well today, that's for sure," Murray said. "He's a very good player especially on this surface, so I knew it was going to be a tough one and I wasn't able to play well enough. I did ok physically, not the best, but I've been worse."
James Ward now faces Andrea Seppi in the decisive fifth match, with Britain hoping to reach the semifinals for the first time since 1981.
Italy has not lost at home to Britain since 1926, but that record looked in danger when Murray broke Fognini's serve in the first game.
Fognini managed to save two break points but double-faulted to hand Murray the opening game.
The 13th-ranked Fognini had the opportunity to break straight back but hit long and then netted on another break point as Murray went on to take a 2-0 lead.
In a typically lively Davis Cup atmosphere, British fans chanted "Fabio, we are in your head," but that seemed to inspire Fognini to a higher level and he was cheered on by the vociferous home support.
Fognini broke Murray to love and raced into a 40-0 lead, losing just two of 14 points.
The Italian broke again when Murray double-faulted after rescuing two break points, and he won his fifth straight game to take the opening set.
Murray almost dropped serve again early in the second set as he had to fend off two break points after being 40-0 up.
However, Fognini broke twice at the end of the second set, moving into a 2-0 lead following another double-fault from Murray on the first of two break points.
The final set went with serve until the final game, which saw Fognini rack up a 40-0 lead on Murray's serve.
Murray saved one match point when Fognini netted a forehand, and rescued the second with a crosscourt volley but hit the third into the net.
It was Murray's second defeat in 20 singles matches in the Davis Cup. Fognini moved to 14-2 on clay this season.