The German, clinching his third win this season, managed to hold off Hamilton until the end, with Williams driver Valtteri Bottas taking his first ever podium, in what turned out to be a disastrous home race for Red Bull.
Bottas's teammate Felipe Massa, who had started on pole, was fourth, followed by Ferrari's Fernando Alonso, Sergio Perez of Force India and McLaren's Kevin Magnussen.
The season's eighth race saw Mercedes extend their lead in the constructors' standings to 301 points, with Red Bull trailing in a distant second place with 143 points.
Sunday's race at the Red Bull Ring started with an all-Williams front row after Brazilian Felipe Massa and Bottas put in a superior performance in Saturday's qualifying, depriving Mercedes of pole for the first time this season.
More From This Section
But the German team showed already in the first lap that they were in fighting spirit, with Rosberg briefly coming into second position, while Hamilton jumped from ninth into fourth place after a thundering start.
After taking his first pole position since 2008, Massa had hoped to follow this up with his first win in six years, but this was not to be.
For Red Bull, which went into this home race having won the Canadian Grand Prix, the day proved a wash-out with Daniel Ricciardo finishing eighth.
A disappointing season for reigning four-time champion Sebastian Vettel of Red Bull meanwhile went from bad to worse as he was forced to retire.
Having started in 12th position, he never had a chance as his car came to a complete halt shortly after the start.
He managed to restart but had to call it quits halfway through the race, having also had a minor brush with Sauber's Esteban Gutierrez that was being investigated.
Sergio Perez of Force India posted some of the fastest laps on the track and managed to move up to sixth postion after starting in 15th place for causing a crash in Canada with Massa.