Ferrari's qualifying bid was derailed by team-mate Charles Leclerc's undiagnosed car issue that got the Monegasque driver eliminated in Q1 for the first time this season.
But in front of his Spanish fans, Sainz had a much stronger afternoon by taking second place behind the untouchable Red Bull of world champion Max Verstappen.
"It was very good today, I felt like I was driving very well," Sainz said about his best qualifying result of the 2023 F1 season.
"It's always one tenth here, one tenth there. But I was pushing, I didn't leave anything on the table today. I was pushing flat out.
"It was very tight even with McLaren, with Alpine, with Mercedes, Aston Martin; we were all in the same group basically this weekend. So, I think P2 is as far as I could make it today, and that [1m]12.7s is a pretty good lap."
Sainz said the low-grip conditions after earlier rain showers made Saturday "one of the trickiest" qualifying sessions ever at the Circuit de Barcelona-Catalunya.
The conditions caught several of his rivals out.
Sainz ended up conceding 0.462s to Verstappen but was crucially less than one tenth ahead of surprise third Lando Norris in the first McLaren, the Alpine of Pierre Gasly and Mercedes driver Lewis Hamilton.
"I needed [a great lap] because it was super tight," 28-year-old Sainz added. "It was very, very tricky conditions out there today.
"Even getting through Q1, Q2 without any issues and putting a good lap in, even with only one set in Q3 was probably one of the most tricky qualifying [sessions] I've had here in Barcelona in terms of conditions.
"But we did it and I think we're in the best possible position going into tomorrow. And now we can focus on trying to get that podium tomorrow."
Team-mate Leclerc will start Sunday's grand prix from 19th on the grid after reporting weird behaviour from his Ferrari through Barcelona's left-hand corners.