The Mercedes driver produced a stunning fastest lap of one minute and 27.319 seconds for his first pole at the 5.8km track and 71st of his career.
While both drivers's sessions were ended by the respective incidents, Bottas still topped the times with a 1m29.055s set on the soft compound tire.
"Incredible", said the Briton, in post-qualifying interviews conducted by his former McLaren team mate Jenson Button in front of the crowd.
"With the incident I had in FP3, there was some extra work for the guys, and they did really well to get the auto together, it worked perfectly so I'm really thankful for that", Bottas said.
"This is the first time and definitely the first auto which has felt underneath me all weekend with small tweaks in the right direction".
He added: "It has taken me forever to get this pole".
Due to a grid penalty of five places, Bottas will start in the seventh place, while Vettel moves to the second. "It didn't work, but still happy with third and front row for tomorrow".
"Last weekend was a bit of a disaster but we still got pole, which was unusual". "I have never really had this view here".
He said: "It's been an interesting day, the vehicle is feeling much better than it was in Malaysia. Starts have generally been strong this year". "But I think the Ferraris did bring quite a big upgrade in the last race so it's going to be interesting to see that probably being unleashed and also the Red Bull is coming back up". "I love the track".
The Ferrari driver started the race but it was immediately clear there was something still wrong with his vehicle as he slipped back on the opening laps, losing places to Max Verstappen, Esteban Ocon, Daniel Ricciardo and Valtteri Bottas.
While Bottas stayed in the garage in second practice, Hamilton felt it important to give the spectators something to watch. Apart from Bottas, Ferrari's Kimi Raikkonen also suffered a crash during free practice 3 that prompted gearbox replacement and has attracted a penalty as well.
The Japanese Grand Prix takes place on the Suzuka Circuit.
With those applied, the provisional grid reads: Hamilton, Vettel; Ricciardo, Verstappen; Ocon, Bottas; Perez, Massa; Vandoorne, Raikkonen; Hulkenberg, Magnussen; Grosjean, Gasly; Stroll, Ericsson; Wehrlein, Palmer; Sainz, Alonso.
Early in the hour, Q1 came to an explosive end as Romain Grosjean lost control of his Haas going up the hill behind the paddock, after putting a wheel over the kerb.