|Haas, ranked 87th, recovered from losing serve by taking the first set in a tiebreaker. (Getty Images)|
It was Federer's first loss to a German player since Nicolas Kiefer's semifinal win, also in Halle, 10 years ago.
The 87th-ranked Haas, the oldest player in the singles draw at 34, recovered from losing his serve in the first game by winning the first set on a tiebreaker and then getting the decisive break in the ninth game of the second set.
"I'm very impressed with how he played today," Federer said. "Tommy deserved to win."
The second-seeded Federer was bidding for his fifth tour title of the season and his 75th overall.
It was Haas' first win over his good friend in 10 attempts, and his third overall against 16-time Grand Slam champion Federer from 13 meetings.
Haas got the break to earn a 5-4 lead after a lengthy rally featuring lobs, chips and a drop shot, following two unforced errors in succession from Federer that allowed him to force deuce.
Haas last won the grass-court tournament in 2009, when he beat Novak Djokovic in the final.
He hadn't appeared in a final since then, so perhaps nerves played a role in his loss of serve in the first game. Both players had only been broken once this week.
Federer missed another break point in the fifth game to leave the score 3-2, and Haas pulled himself level by breaking him in the next, when Federer uncharacteristically netted a simple return.
Haas missed two break chances with the score at 5-4 to win the set, sending a return long and not dealing with another. Federer eventually won the game with his fifth ace to level 5-5.
"I should never have lost the first set, so that hurt. He got momentum after that," Federer said.
The Swiss got a mini-break in the tiebreaker on Haas' first serve, but Haas again came back with one of his own to establish a 4-2 lead.
A Haas fan called for him to fire an ace, and there was a huge roar from the crowd when he duly obliged with his third to move the score to 5-3.
Another mini-break put the German in a position to win the set, and he didn't let it slip.
"I'm just really happy for him ... happy that he's been able to fight off so many injuries and come back and still believe in himself, still want to travel, still want to sacrifice his family [life] too," said the 30-year-old Federer.
It was the first final in the 20-year history of the tournament to feature two players aged 30 or older.
Federer's only previous final loss in Halle was in 2010, when he lost to Lleyton Hewitt.