Bottas was +0.059 seconds in Q3 with the final sector proving to be the difference between the Finn and Mercedes team-mate Hamilton.
Bottas will start from second place for Sunday's Spanish Grand Prix as Mercedes locked out the front row in Barcelona for a seventh time in eight years.
The Finn explained: "I knew it was going to be close with Lewis as always.
"I think in the end, the first lap he did was really nice and clean, especially sector three. All day today I've been struggling in sector three. It was getting better and better but still not quite good enough.
GPFans is a multi-platform, multi-language brand dedicated to Formula One coverage. We bring you all the ins and outs of the sport, 24/7, everything from up-to-the-minute news and features to the latest viral stories and clips.
We believe that a new generation of exciting, outspoken drivers will make F1 more popular than ever before, and we want to give our users access to as much of their heroes as possible, on and off the track. From Lewis Hamilton to Max Verstappen, Daniel Ricciardo to Sebastian Vettel, we provide in-depth analysis of every every Grand Prix in the season, from Australia to Abu Dhabi.
With Formula One under the new ownership of Liberty Media, how the sport is being covered is evolving, and GPFans will look to be at the heart of this progression into new media, as one of the fastest-growing sites covering the king of motorsports.