The seven-time world champion announced his decision a few days before the Japanese Grand Prix on Sunday, where he will race for the German auto giant again.
"I've decided on this step even though I can still compete," the 43-year-old Schumacher said in a statement. "We didn't hit the targets we were aiming for. But I'm proud of what I've achieved."
Schumacher, who originally retired in 2006 before making a spectacular comeback in 2009 at the age of 40, said he had lost the energy and the motivation.
Mercedes announced last week that it would not be extending Schumacher's contract at the end of the season, simultaneously unveiling Hamilton - the 2008 world champion with McLaren - as their new star pilot.
Schumacher had a staggeringly successful Formula One career before his first retirement, winning 91 races on his way to the world championships in 1994 and 1995, before going on a five-year winning streak from 2000 through to 2004.
But he has been unable to come close to that in the past three seasons, with only one podium finish in 52 races - he came third at the European Grand Prix in Valencia this summer.
World champion Sebastian Vettel said Thursday he was saddened to hear that compatriot Michael Schumacher has decided to again retire from Formula One.
"This is a shame and a great loss for Formula 1. In the last three years we had a lot of fun with him," said the 25-year-old Red Bull driver.
"For a long time, his return might not have gone the way he imagined it would. But I think the car simply didn't produce enough and he couldn't strut his stuff like he used to."