Hamilton attempted a late charge for victory, but Bottas had enough in his pocket to take the chequered flag and move one point clear of the Brit in the title standings.
It will also go some way to making up for the pain of previous year, when he suffered a puncture while leading the race with just two laps remaining.
"It was actually a tough race, even though not that much was happening at the front", Bottas said afterwards, thrilled about his fifth career victory. "You can see how wrong it can go in Shanghai for some of the cars that weren't able to cross the line".
Ferrari did call Leclerc in for a second stop late on, as he had a buffer to the auto behind big enough to take on fresh tyres and challenge for the point on offer for fastest lap, which he successfully gained on the penultimate attempt.
George Russell's Williams auto was damaged by a loose manhole cover - one of 300 on the twisty Baku street circuit - which meant only two cars clocked lap times. Kvyat, meanwhile, was philosophical about what happened, despite losing a solid chance to score points for the second time this season. Ironically, Leclerc's crash had extended the session to allow for barrier repairs and saw Q3 start at 18:45 local time.
"I don't feel good about what happened", Ricciardo said shortly after apologising to Kvyat.
Son Heung-min trusts Spurs team-mates to beat Ajax without him
The training ground, the stadium, the fan base, the players... we just have to take that next step next season and see where that takes us.
"The secret this year seems to be the tyres and maybe we are missing something", Vettel said.
Daniel Ricciardo: "It was a odd incident which forced the retirement, but it was my mistake and I'm sorry to the team and to Daniil [Kvyat]".
Hamilton very almost got the lead when he made a better start than his team-mate but, having got alongside Bottas into Turn One, he was unusually accommodating to the Finn on the outside.
Vettel, a four-times Formula One world champion, was 0.198 seconds slower. But he lost ground during a late virtual safety vehicle period - his mistake - and Bottas controlled the race well to just keep Hamilton at bay.
"We need to look forward and improve the way we handle things, the way we work to just get faster".
"All weekend we haven't really been on it, so getting into the points would've been a fairly good recovery for us. I knew the race would be very long and I just focused on myself to be as quick as possible on this medium run".
"I think everybody's been there".