The deal will see Hamilton partner with Mercedes for a ninth season and puts an end to months of speculation over the Briton’s immediate future in the sport.
Hamilton has dominated the F1 landscape since joining Mercedes from McLaren in 2013, winning 74 races as well as six drivers’ championships.
He set up a commission in his name to increase diversity in motorsport with the hope of making “real, tangible and measurable change.”
Mercedes said the new deal would include a “joint commitment for greater diversity and inclusion.”
“I am excited to be heading into my ninth season with my Mercedes teammates,” said Hamilton.
“I’m equally determined to continue the journey we started to make motorsport more diverse for future generations and I am grateful that Mercedes has been extremely supportive of my call to address this issue.
“I’m proud to say we are taking that effort further this year by launching a foundation dedicated to diversity and inclusion in the sport. I am inspired by all that we can build together and can’t wait to get back on the track in March.”
Hamilton will bid to win a record-breaking eighth world title when the 2021 season begins in Bahrain on March 28.