Mantilla, who had battled through four tough matches in the tournament to make his first final of the year, beat Switzerland's Federer 7-5, 6-2, 7-6 to win his 10th title.
"I believe I won today because I had the hunger. I played with heart and courage and everything I had," Mantilla told reporters afterwards.
"Of course it's the biggest victory of my life. It'll give me lots of confidence for the future."
Federer, who had only dropped one set in his last nine claycourt matches, was bidding to claim his fourth title of the year, after triumphing in Marseille, Dubai and Munich.
He mixed the pace of his groundstrokes to create seven break points, but wasted them all, in the first set.
The 29-year-old Mantilla then took advantage of a double fault and a long forehand to break in the 12th game and win the first set.
The fourth seed stepped up his game at the beginning of the second set, breaking Mantilla's service with some heavy hitting from the baseline but the Spaniard broke back in the sixth and eighth games of the second set to run out a comfortable 6-2 winner.
In a see-saw third set Federer produced his most consistent play of the match, coming to the net more often and recovering from a break down to earn a chance for the set at 5-4.
But Mantilla chased down a drop shot to flick a winner crosscourt and earn a break point before a double fault by Federer sent the set into a tiebreak, which Mantilla won when Federer smashed a forehand over the baseline.
"I lost so many points today even though I felt I was doing the right thing," said Federer. "I'm walking off this court today thinking it was meant to be, because so many times the game went his way -- on calls, balls on the line, everything.
"It's very tough to accept this. But I guess I have to. He played a good game."
More from rediff