Updated

Formula One driver Lewis Hamilton is leaving McLaren to replace Michael Schumacher at Mercedes for the 2013 season.

Mercedes announced on Friday that Hamilton, the 2008 F1 world champion, signed a three-year contract with the team. He will pair with Nico Rosberg, who has been with Mercedes since 2010. The signing of Hamilton ended months of speculation that he would depart McLaren and join Mercedes at season's end.

Hamilton has driven for McLaren since his 2007 rookie season, scoring 20 victories, including three this year, and making 48 podium appearances in 104 grand prix starts. He has also posted 24 pole wins. Hamilton has claimed the pole in the last two races -- Italy and Singapore. The Brit is currently fourth in the championship standings, as he trails leader Fernando Alonso from Ferrari by 52 points.

"It is now time for me to take on a fresh challenge, and I am very excited to begin a new chapter racing for Mercedes," Hamilton said in a team statement. "Mercedes-Benz has such an incredible heritage in motorsports, along with a passion for winning which I share.

"Together, we can grow and rise to this new challenge. I believe that I can help steer the 'Silver Arrows' to the top and achieve our joint ambitions of winning the world championships."

Hamilton's career has been supported by Mercedes-Benz and McLaren since its earliest days. In 2000, Hamilton and Rosberg were teammates at Mercedes in Formula A karting. He drove with Mercedes-Benz engines during his two seasons in the Formula 3 Euroseries, winning the 2005 championship.

"Looking ahead to 2013, I am delighted to welcome Lewis Hamilton to our team," Mercedes team principal Ross Brawn said. "The arrival of a driver of Lewis' caliber is a testament to the standing of Mercedes-Benz in Formula One, and I am proud that Lewis shares our vision and ambition for the success of the Silver Arrows.

"I believe that the combination of Lewis and Nico will be the most dynamic and exciting pairing on the grid next year, and I am looking forward to what we can achieve together."

Schumacher, the record seven-time F1 titleholder, has been with Mercedes since he came out of retirement in 2010. The 43-year-old German has struggled in his three years with the team, recording only one podium finish -- a third-place run in this year's European Grand Prix.

"I have had three nice years with the team, which unfortunately, did not go as well as we all would have wanted on the sporting side," Schumacher said. "I wish Lewis well and for the team to achieve the success we worked so hard for in the build-up. I would like to thank the team for their trust and all the guys for their unconditional commitment. I will now concentrate on the next races."

Schumacher is presently 12th in points, and has failed to finish seven of the 14 races this season. It's not known at this time what Schumacher's F1 plans are for the future.

"(Schumacher's) energy and commitment have never wavered, even when results have not matched our own expectations, and we are determined to finish the 2012 season together on a high," Brawn noted. "As always, it has been a pleasure to work with Michael."

On the same day that Mercedes announced the signing of Hamilton for the upcoming season, McLaren revealed that Sergio Perez will replace Hamilton and team with Jenson Button for next year. Perez is in his second season in F1, driving for Sauber. The 22-year-old Mexican finished a career-best second in this year's grand prix in Malaysia and Italy.

"I'm under no illusion that it is indeed a very big step, as it would be for any driver, but I'm ready for it," Perez said in a statement. "So, while I'm still fully focused on doing my best for Sauber for the remainder of this season, I'm already massively looking forward to working with everyone at McLaren, and with Jenson, who's someone I've long admired as a brilliant driver and a great champion."

There had been wide speculation that Perez would join Ferrari to replace Felipe Massa. Perez was a member of Ferrari's driver development program.