Hamilton is currently participating in his sixth campaign with Mercedes, with world titles being won in three of the last four seasons, but the British driver's deal had been due to expire at the end of the year.
However, the two parties have now come to terms over an extension, with Hamilton suggesting that the new contract had been "a formality" since holding discussions in the winter.
The 33-year-old said: "This contract extension has basically been a formality since Toto [Wolff] and I sat down during the winter, so it's good to put pen to paper, announce it and then get on with business as usual."
"I have been part of the Mercedes racing family for 20 years and I have never been happier inside a team than I am right now."
"We are on the same wavelength both on and off track - and I am looking forward to winning more in the future and shining even more light on the three-pointed star. I'm very confident that Mercedes is the right place to be over the coming years."
Hamilton currently finds himself eight points adrift of championship leader Sebastian Vettel ahead of this weekend's German Grand Prix.