Pierre Gasly said he was "shocked" with his drive to sixth place in the Hungarian Grand Prix for Toro Rosso, calling the result a "dream" after recent struggles for form.

After capitalising on wet conditions to qualify sixth on Saturday at the Hungaroring, Gasly passed Carlos Sainz Jr. on the opening lap to run fifth in the opening stages of the race.

While he would be passed by the recovering Daniel Ricciardo later on, Gasly finished a comfortable sixth at the chequered flag, and was the only midfield driver not to get lapped by race winner Lewis Hamilton.

Hungarian GP - Best Moments

"I knew that I had to overtake Carlos at the start just to have free air and to be able to push as hard as I could," Gasly explained. "My start wasn't fantastic, but then after into Turn 1 I stayed on the inside and fought a bit with Max [Verstappen]. I got Carlos on the exit, and after that I knew that I had my chance in my hands.

"I just had to push as hard as I could with the car, try to keep the tyres alive, and just went exactly as in a dream. It was great."

Gasly said he knew it was turning out to be a good race when he saw cars ahead of him getting shown blue flags to let him pass.

"I think the first time that I saw blue flags for cars ahead of me, when I saw that, I was like: 'Fuck! It means I'm doing a good race!'

"Usually the blue flag is for me for the Ferrari or the Mercedes, so that was a pretty cool feeling."

The result marked Gasly's third points finish of the season following top-10 finishes in Bahrain (P4) and Monaco (P7), with the latest success coming as a surprise to the Frenchman given Toro Rosso's recent struggles.

"Honestly since the beginning of the year, Bahrain, Monaco and this weekend were the only [races] where we could have got this kind of result," Gasly said.

"Especially after the last three, four races, honestly I'm quite shocked again to be able to get that P6. Last weekend in qualifying we got stuck in Q1, behind one Williams, and this weekend we lapped one of the Williams in the race.

"There are just tracks where the car works much better. It's quite surprising. But when it does work like this, we need to make sure we can take all the points we can."