Sepang - Yamaha's Johann Zarco was Saturday bumped up to pole position for the Malaysian MotoGP, taking Marc Marquez's spot after the world champion was penalised for an incident involving Italian rider Andrea Iannone.
Honda's Marquez clocked up the fastest lap and looked to have secured the 80th pole position of his career in a rain-hit qualifying session at Sepang, in which he had a minor crash.
But after the race, he was hit with a hefty six-place grid penalty, meaning he will start in seventh.
The Spaniard was sanctioned over an incident involving Suzuki rider Iannone, in which he was judged to have been riding irresponsibly and to have got in the Italian's way on a sharp corner.
The changes mean that Frenchman Zarco will now start in pole position in Sunday's Grand Prix while Italian legend Valentino Rossi will begin in second place.
After a delay of over an hour due to a tropical downpour, Saturday's qualifying session got underway with Marquez clocking up the fastest lap time of 2:12.161 fairly early on.
Marquez managed to maintain his lead despite a crash after about 10 minutes, which saw him tumble out of the saddle as his bike slipped on a sharp turn.
He got up unhurt, quickly changed to a new bike, and continued racing.
"Today I take profit of one of my strongest points, that is I adapt really quick to the conditions," said Marquez.
Zarco said he was hoping for another podium finish at Sunday's MotoGP, after he came third at Sepang last year.
"It would be nice to be on the podium tomorrow," he said.
But there was disappointment for Ducati's Andrea Dovizioso, who crashed late on in the race, and ended up clocking only the fifth fastest time.
The result dented his hopes of winning for a third time in a row in Malaysia and finishing the season as runner-up overall.
He is currently second-placed in the overall standings with nine-time world champion Rossi - who last won in Malaysia in 2010 - just 15 points behind in third.
Organisers decided to shift Sunday's Grand Prix forward by two hours to 13:00 in a bid to avoid the heavy rains that typically fall later in the afternoon in Malaysia.
"For me it is a clever choice (to hold) the race at 13:00. We will have more chance for a dry race," said Rossi.
"If we wait until 15:00, maybe we don't race."
The sudden heavy downpours and humidity have long been a challenge for riders in the Malaysian Grand Prix. The last two editions of the race were both hit by torrential rains.
Grids for the Malaysian motorcycling Grand Prix after qualifying on Saturday:
1. Johann Zarco (FRA/Yamaha Tech3) 0.548, 2. Valentino Rossi (ITA/Yamaha) 0.848, 3. Andrea Iannone (ITA/Suzuki) 0.936
4. Andrea Dovizioso (ITA/Ducati) 1.022, 5. Jack Miller (AUS/Ducati) 1.113, 6. Danilo Petrucci (ITA/Ducati) 1.252
7. Marc Marquez (ESP/Honda) 2:12.161 (fastest lap time but he was hit with a six-place grid penalty), 8. Alex Rins (ESP/Suzuki) 1.302, 9. Alvaro Bautista (ESP/Ducati) 2.024
10. Dani Pedrosa (ESP/Honda) 2.282, 11. Maverick Vinales (ESP/Yamaha) 2.695, 12. Aleix Espargaro (ESP/Aprilia) 3.179
1. Alex Marquez (ESP/Kalex) 2:05.629, 2. Luca Marini (ITA/Kalex) 0.488, 3. Fabio Quartararo (FRA/Speed Up) 0.666
4. Remy Gardner (AUS/Tech3) 0.718, 5. Mattia Pasini (ITA/Kalex) 0.810, 6. Francesco Bagnaia (ITA/Kalex) 0.920
7. Miguel Oliveira (POR/KTM) 0.988, 8. Xavi Vierge (ESP/Kalex) 1.058, 9. Brad Binder (RSA/KTM) 1.112
1. Jorge Martin (ESP/Honda) 2:11.731, 2. Marco Bezzecchi (ITA/KTM) 0.032, 3. Tony Arbolino (ITA/Honda) 0.334