Rosberg, 29, joined Mercedes on the German car giant's return to F1 in 2010. In five seasons he has won six times, with 17 podiums and eight pole positions.
"Mercedes....Is delighted to announce that it signed a multi-year contract extension with Nico Rosberg on 14 July 2014," a statement on the team's official website confirmed.
Mercedes motorsport chief Toto Wolff added: "This new contract brings us important stability and continuity for the future and I am delighted to be able to make the announcement in time for the home race of Mercedes-Benz and Nico in Hockenheim."
Hamilton, the 2008 champion, made up ground on Rosberg when claiming victory at Silverstone last time out, with Rosberg, who had set pole, failing to finish.
More From This Section
Up to the British Grand Prix Rosberg had finished first or second in all previous eight races.
Rosberg said he was "proud" to drive for the team he described "as the best in the world".
"It has been a difficult road to get to where we are now - but everybody kept believing and, thanks to the fantastic support from Mercedes-Benz, we are now leading the way in F1," he said.