He beat Jeremy Hunt comfortably, winning 92,153 votes to his rival’s 46,656.
The former London mayor takes over from Theresa May on Wednesday.
In his victory speech, Mr Johnson promised he would “deliver Brexit, unite the country and defeat Jeremy Corbyn”.
Speaking at the Queen Elizabeth II centre in London, he said: “We are going to energise the country.
“We are going to get Brexit done on 31 October and take advantage of all the opportunities it will bring with a new spirit of can do.
“We are once again going to believe in ourselves, and like some slumbering giant we are going to rise and ping off the guy ropes of self doubt and negativity.”
Mr Johnson thanked his predecessor, saying it had been “a privilege to serve in her cabinet”. He was Mrs May’s foreign secretary until resigning over Brexit.
The outgoing PM – who is standing down after a revolt by Conservative MPs over her Brexit policy – congratulated her successor, promising him her “full support from the backbenches”.
Foreign Secretary Mr Hunt said he was “very disappointed”, but Mr Johnson would do “a great job”. He said he had “total, unshakeable confidence in our country” and that was a valuable quality at such a challenging time.
Mr Hunt added: “It was always going to be uphill for us because I was someone who voted Remain and I think lots of party members felt that this was a moment when you just had to have someone who voted for Brexit in the referendum.
“In retrospect, that was a hurdle we were never able to overcome.”
Donald Trump told an event in Washington “a really good man is going to be the prime minister of the UK now,” and Mr Johnson would “get it done”, referring to Brexit.
The president added: “They call him Britain Trump. That’s a good thing.”
Almost 160,000 Conservative members were eligible to vote in the contest and turnout was 87.4%.
Mr Johnson’s share of the vote – 66.4% – was slightly lower than that garnered by David Cameron in the 2005 Tory leadership election (67.6%).
The former London mayor and ex-foreign secretary spoke to staff at Conservative Party HQ after his victory was announced.
He was then given a rousing reception by Tory MPs at a meeting in Parliament, where he urged them to “unite, unite, unite and win”.
The BBC’s Nick Eardley, who was outside the room, said such gatherings had been gloomy and downbeat for many months, but this one was full of laughter.
One MP told our correspondent: “The BoJo show is up and running.” Another said: “The cloud has been lifted.”