Nadal, a 14-times grand slam champion, has endured an indifferent season winning just two titles in Stuttgart and Buenos Aires prior to Sunday and dropped to number 10 in the world rankings.
World number 32 Fognini, who won the Hamburg title in 2013, was aiming for an almost unthinkable third claycourt victory against Nadal this season following successes in Rio de Janeiro and Barcelona.
Nadal, whose previous air of invincibility on clay has begun to evaporate, hit just six winners and 15 unforced errors in an evenly contested opening set.
Highlights: Salisbury and Skupski win doubles decider to send Britain through
He was, however, aided by Fognini who was broken three times in the set and blundered 34 of his own unforced errors following a series of brutal baseline rallies.
Nadal appeared to have gained the upper hand early in the second set and broke en route to a 3-1 lead but Fognini roared back with successive breaks to take a 4-3 lead.
In a topsy-turvy set Nadal and Fognini were unable to gain the ascendancy and traded breaks as parity was restored at 5-5 before the Spaniard took a 6-5 lead to leave his opponent to serve it into a tiebreak.
Image credit: Eurosport
Fognini was unable to do so and succumbed to defeat when he blazed a forehand long before a clearly emotional Nadal fell to his knees and saluted the crowd after the final point.
The Italian eighth seed played his part in an entertaining final crushing 39 winners to Nadal's 19.
Nadal enjoyed a measure of revenge in completing a win over Fognini to carry off his first Hamburg Open since 2008. The Spanish top seed had lost twice in Rio de Janeiro and Barcelona to Fognini this season, but ensured he was not going to lose for a third time against an Italian player who also enjoys the ongoing nature of clay. Nadal’s win in the final on his favourite surface against a fellow dirtballer was probably more satisfying after he lost to Dustin Brown in the second round of Wimbledon last month. Is it too early to proclaim him among the favourites for the US Open next month? Perhaps.
Unlike this tournament, he will have to step back onto the hard courts of North America to see where he stands ahead of such a challenge, but this should give him immense satisfaction for the rest of the season. Any title success has to be welcomed, and this should restore confidence to Nadal's game that seemed to dissipate during Wimbledon. He will go to Flushing Meadows under the radar as fifth favourite for the US Open behind Novak Djokovic, Andy Murray, Roger Federer and Stanislas Wawrinka. He is perhaps fifth of a 'big five' but at 12-1 must be worth a flutter for what he can be on top form. This is a man who has won the US Open in 2010 and 2013. Write him off at your peril.
Highlights: Norrie sparks GB comeback against Czech Republic
Great Britain through to quarters after 2-1 win over Czechs