Brendon Hartley was pleased to reach Q3 for the first time in his Formula 1 career after capitalising on wet conditions in qualifying for the Hungarian Grand Prix on Saturday, with the New Zealander saying he had to "put my balls on the line" to make it to the final session.

Hartley beat his previous best qualifying result of 11th in Bahrain earlier this year by qualifying eighth at the Hungaroring, giving Toro Rosso its first double-Q3 appearance of the year as teammate Pierre Gasly secured P6 on the grid.

Hungarian GP - Best Moments

Both drivers had been doubtful of their chances of reaching Q3 in dry conditions on Saturday, but made the most of changeable conditions through qualifying to finish so highly.

Hartley explained how reaching the top 10 was his biggest challenge in qualifying as rain grew heavier through Q2, having been one of the last drivers to improve their lap time.

"It was a tough session for everyone, getting through to Q3 was already a big task. We were a bit delayed getting out in Q2, so I really had one chance on that first lap," Hartley said.

"The conditions were worsening, and I'm really quite proud of the lap that I did in Q2 to get through, because the last sector was a river, and on intermediate tyres it was really tough. I think I had [Fernando] Alonso in front who didn't get through and I think Daniel [Ricciardo] behind, it's probably why he didn't get through, because conditions were getting worse and worse and worse.

"We were a little bit delayed getting out, so I really had to put my balls on the line in the last sector to get through, and it paid off."

Hartley admitted he was disappointed not to qualify higher in Q3, with off-track moments compromising two of his four laps before a more measured effort later in the session.

"I had four laps, and the second two laps I went off. I actually had a really big moment at Turn 4 where I was close to the wall, so my last lap I was somewhat conservative," Hartley said.

"I just had to get a lap on-track. There was definitely margin there. Pierre did a slightly better job in Q3, but from the team's point of view, everyone's extremely happy with that. Happy with how I performed, and used my experience to the best of my abilities."

Gasly was quick to heap praise on the Toro Rosso team after matching his best qualifying result of the season, having also started sixth in Bahrain.

"Honestly it was an incredible day. With the conditions - what a session, slick tyres, inters, wets - we didn't know what to expect because we didn't run on the wets at all this weekend," Gasly said.

"Just trying to keep the car on-track was difficult, and after the really tough weekends we had recently, for the team it's just an amazing result."