Fernando Alonso said everything "went perfectly" for McLaren as he qualified for his home Spanish Grand Prix in an impressive seventh position.
The two-time world champion has been plagued by reliability problems this season and an ERS [Energy Recovery System] issue stopped him from starting in Sochi last time out.
Alonso's woes looked set to continue in Barcelona when he was forced to sit out FP1 on Friday and clocked the slowest time in the second session.
However, the 33-year-old delighted the home fans and himself by reaching Q3 for the first time this year - waving to those who afforded him a standing ovation on his in lap after Q2.
"I was preparing myself yesterday for qualifying. Everything today went perfectly. It's a nice surprise," Alonso told Sky Sports.
"We saw the potential yesterday and today we put everything together.
"I'm happy for the team, they changed many power units and to now be P7 and be on the grid around the cars we should be fighting with will be really nice.
"Always here I find this extra motivation to take care of the car. It's a good grand prix for me but the race is tomorrow. They don't give out points on Saturday."