Danilo Petrucci inflicted a last-lap defeat on Marc Marquez and Andrea Dovizioso for a dream debut MotoGP victory, in front of his home fans at the Italian Grand Prix.

The Mugello win also paves the way for a 2020 factory Ducati contract extension, having gone into the weekend under pressure from Pramac's Jack Miller.

Ducati say they will discuss Dovizioso's future team-mate after the next round in Catalunya. But Petrucci's triumph - hot on the heels of a podium in France - combined with another DNF for Miller, means the Italian is now the obvious candidate on paper.

Petrucci considered quitting as he struggled for results earlier in his career, feeling MotoGP might not be for him, and viewed this year's factory Ducati chance as make-or-break: "If I cannot win with this bike, then I’m not able to win with any bike."

"I thought many times in the past to quit my career because I said 'this [MotoGP] is not my world'," Petrucci explained.

"Also, at the beginning of this year, because I have no contract for next season I put pressure on myself and the first three races were not so good.

"Once again it was Andrea that helped me, telling me not to think about the future. Think about now. Try to enjoy what you are doing. Focus on your strong points, work hard.

"From Jerez, I just think, 'I will do my best. If it's enough, okay. If not, and if I cannot win with this bike, then I’m not able to win with any other bike, so [MotoGP] is not my world'.

"But today I won, so maybe I will change my mind about the future!"

Petrucci has now achieved the target set for him by Ducati and reiterated before today's race, which he began from the outside of the front row.

"At the beginning of the season we had a meeting and Ducati said for sure the target was to win, and I have to win, but not do anything strange with Andrea.

"Today there was no [special] meeting, they just said, 'try to win the race'.

"It was my target for this year so now I think I’m more, let’s say, not safer, but relaxed [about the future]. We can think about improving the bike and trying to win the championship with Andrea."

Dovizioso, praised by Petrucci for his advice and support, was disappointed to lose points to Marquez but pleased to see his team-mate win.

"I'm really happy for him, and to win in Mugello is the best race in our championship," Dovi said. "I think this can affect his future [at the team]. I’m really happy about that.

"From what I know, I don’t think the contract will be decided soon. I think Ducati are in a situation where they can wait, but for sure this race will affect a lot."

One of the few MotoGP riders not to have competed in Moto3 or Moto2, Petrucci was instead a Superstock champion who went straight into the premier-class in 2012, riding for the smallest (Ioda) team and slowest bike.

Hard work eventually paid off in the form of improving teams, machinery and results, all culminating in Sunday's emotional 0.043s victory over Honda's five-time world champion Marquez.

"It’s really great. I still haven't realised that I won my first race," said Petrucci, who like Marquez was suffering from flu all weekend. "This morning I woke up in good condition, but I said it’s going to be very, very hot.

"At the start there were a lot of people trying to stay in the front. After some laps I was able to take the lead and I tried to save my energy and tyres for the final laps... I thought maybe on the last lap someone would try to pass me. I was right."

Slipstreamed by Marquez and Dovizioso at the start of the final lap, Petrucci responded with a race-winning double-pass as he sliced under them both at the apex of turn one, sitting Dovizioso up in the process.

"When I saw Marc and Dovi passed me, I said 'no! Another time leading and I will finish third, maybe fourth'. Then they went a little bit wide. I just found a little space and I went in.

"I’m so sorry that Andrea had to sit up, but I knew that today I had a great chance to reach my first victory."

Popular for his self-deprecating humour, Petrucci - four-times a runner-up in MotoGP - quipped he still expected victory to be snatched away at the final moment:

"When I was leading out of the last corner I said, 'it's the story of my life, I will go out of the last corner in first and finish the race in third'.

"I put fourth gear, fifth gear - waiting for Marc and Dovi to pass me - then I put sixth and in that moment I crossed the finish line.

"I had been trying to manage my energy during the race, then after the finish I started to scream and it was harder to do the slow down lap because I couldn't breathe!"

LCR Honda's triple race winner Cal Crutchlow is the only other rider on the current grid not to have competed in the smaller grand prix classes.

"Petrucci is going to give Dovi a hard time," Crutchlow predicted during February's Sepang test, adding that the #9 is widely underestimated "because he came from Superbike."

Petrucci is now fourth in the world championship, 21-points behind Dovizioso but 40 clear of Miller.