SHANGHAI - Mercedes has become used to starting on the front row after a dominant couple of years in Formula One. Not so much from the back of the field.

Nico Rosberg will take the team's customary spot of pole position at the Chinese Grand Prix on Sunday, but defending world champion Lewis Hamilton will have to start from the last row after an early exit from qualifying due to a power unit problem.

Rosberg set a time of 1 minute, 35.402 seconds on Saturday despite using a harder tire than his rivals, qualifying a half-second ahead of Red Bull's Daniel Ricciardo in a surprise second place.

Ferrari's Kimi Raikkonen and Sebastian Vettel qualified third and fourth, respectively, after misjudging the final hairpin turn on their last laps.

Hamilton had issues with his engine throughout the first segment of qualifying and, even though his team tried to repair the problem, he couldn't set a timed lap.

The last time Hamilton started this far back on the grid was at the 2014 Hungarian Grand Prix when he qualified last after his engine caught fire. He worked his way through the field to finish third in that race.

The British driver was hoping to replicate that feat on a Shanghai circuit where he's had particular success in the past, winning four races.

"I take encouragement from (the fact) I've been driving a long time ... there's no question in my mind of how I'm going to battle my way through tomorrow," Hamilton said. "Whether or not you can get all the way up to third, I think that's going to be a very, very tough challenge, for sure."

It's been a frustrating few weeks for Hamilton, who already faced a five-place grid penalty in Shanghai for making an early switch of his gearbox after it was damaged in a collision at the Bahrain Grand Prix.

Rosberg, meanwhile, has been on a roll of late, capturing the first two races of the season and five straight dating to last year.

"I'm pleased, of course. The whole weekend has gone well," Rosberg said. "I'm not ecstatic because Lewis had bad luck and his car broke down so the fight (with him) didn't happen."

Ricciardo has a pair of fourth-place finishes so far this year and is hoping he can hold off the Ferrari cars — and perhaps Hamilton — on Sunday to get back on the podium for the first time since last year's Singapore Grand Prix.

"It's testament to how far we've come since the end of 2015," Ricciardo said. "It feels good to be back up here."

Williams driver Valtteri Bottas qualified fifth, followed by Ricciardo's Red Bull teammate, Daniil Kvyat, in sixth. Sergio Perez of Force India was seventh, with Carlos Sainz and Max Verstappen of Toro Rosso eighth and ninth, respectively.

After early showers wiped out Saturday's final practice session, qualifying got off to an eventful start when Manor driver Pascal Wehrlein hit a bump and lost control in a wet patch just three minutes in, skidding off the circuit and slamming into the barrier.

He walked away uninjured but the red flag came out for 20 minutes as his car was removed and officials dried the track.

Then, at the end of the second segment, Nico Hulkenberg's front left tire came loose, popped off the car and rolled across the grass. Another red flag was shown, ending the session a minute early as both McLaren drivers were trying for a final flying lap to advance to the third qualifying segment.

Fernando Alonso, racing for the first time since fracturing a rib in a dramatic crash at the Australian Grand Prix, let out a loud groan over his radio when the session ended early.

"It was massively frustrating today because we felt competitive," Alonso said. "That was a shame."

Hulkenberg received a three-place grid penalty after F1 officials deemed his team released his car from the pits in an unsafe condition. He initially finished 10th but with the penalty will start 13th, elevating Williams driver Felipe Massa to 10th. Alonso will start 11th, followed by teammate Jenson Button.

Formula One reverted to last year's qualifying format after experimenting with a new rolling-elimination system for the first two races of the season that proved unpopular with drivers and fans alike.

Some fans in Shanghai showed their appreciation for the change, hanging a giant banner from the stands that read, "Finally 'Real' Qualifying is Back."