"I couldn't go quicker on my second lap, which I thought I could, but the first lap was a good job thankfully", said Hamilton. It's very close between us, so every millisecond counts.
Bottas did his utmost on his second run, but it was not enough to overhaul Hamilton's lap time and the Briton was on pole before he completed his flying lap.
"I'm just incredibly grateful to those that have helped and I am blown away still to this day by the decision to move to this team and see the growth that we've had".
He added: "I felt happy in the vehicle and I just hope that I can apply a little bit of pressure".
Red Bull's Max Verstappen was third, ahead of the Racing Points of Sergio Perez and Lance Stroll. Though Lando Norris (McLaren) made it into Q3 by just 0.002sec, Sebastian Vettel was not so lucky and could only muster 11th on the grid.
Track temperatures on the circuit reached 50 degrees C (122 F) when qualifying started shortly after 3 p.m. local time.
Verstappen now sits second in the drivers' championship, 30 points behind Hamilton and four ahead of Bottas.
Formula One world champion Lewis Hamilton has hit out at new rules that restrict qualifying engine modes, suggesting the move is created to slow Mercedes down and it won't "get the result that they want".
Turkey Redraws Currency Defenses With Lira Hitting a Record Low
The Turkish lira reached 7.21 against the dollar as market concerns about the country's macroeconomic management rose. The lira fell 3.4% to 7.2840 versus the US currency as of 5:48 p.m.in Istanbul, leading declines in emerging markets.
The Finn was able to carry on but did scatter a significant amount of gravel across the track as he scampered clear.
The session was red-flagged with minutes to spare when Estben Ocon rammed into the back of Kevin Magnussen's Haas after what appeared to be a moment of distraction or misunderstanding between the two drivers.
The incident is under investigation by the stewards.
"The guys did a great job to get the vehicle ready", Ocon said. Williams was the first to flinch by sending out both its drivers.
But the team remains wary of the threat posed by Red Bull after Verstappen won last weekend's race at Silverstone when both Mercedes cars struggled with tyre management. It also moved the Dutch driver up to second place in the standings behind Hamilton, with Bottas dropping to third.
Hamilton topped the initial runs ahead of the two rapid Racing Points and stayed on top while Raikkonen, for the first time this year, proceeded to Q2 leaving his Alfa Romeo team-mate Antonio Giovinazzi 20th and last. "The forces to our body are pretty intense and the tires are what we are really struggling with".
"The only similarity between Silverstone and Barcelona this week is the ambient and the track temperatures", the Austrian told reporters.
"So we don't expect the same blistering issue like in Silverstone but nevertheless, more degradation and I believe more overheating".