The 45-year-old, nicknamed the Sheriff of Pottingham, fought back from 5-2 down to triumph in Berlin.
World number 14 Carter, winner in 2013, claimed the first three frames.
But Hamilton, ranked 66 and hampered by a neck injury in recent years, chalked up breaks of 118, 73, 74 and 70 as he recovered to secure victory.
Hamilton's run to the final - his first since the 2002 China Open - included wins over the world number one and two, Mark Selby and Stuart Bingham.
The Nottingham potter, who briefly dropped off the main tour last year, was embraced by his father and mother as the crowd gave him a standing ovation after his victory.
"Dreams are made of this stuff," he said.
"It's been a fantastic week and I just can't ask for any more than this.
"I don't know what to do with the trophy as I've never had one."
Carter has won four ranking titles - the most recent in the World Open last summer was his first since being given the all-clear from lung cancer in 2014.
"Anthony played really well. He thoroughly deserved it. I'm delighted for him," Carter said.
Ronnie O'Sullivan, five-time world snooker champion, told Eurosport: "I was on the amateur circuit with him and his mum and dad were there all the time.
"He's very self-deprecating. Every professional in the game will be over the moon for him."
Jimmy White, six-time world championship runner-up: "He's a really nice guy. It's just a wonderful moment. He's given his whole life to the game."
England's Anthony Hamilton won the first ranking title of his 26-year career with a 9-6 victory over Ali Carter in the German Masters final.