Kerry, who ran for president as the Democratic nominee in 2004, will replace Hillary Rodham Clinton, who steps down as America's top diplomat Friday.
After the 94-3 vote, Kerry submitted a letter of resignation, effective Friday, to give up the Senate seat he has held since 1985. He will take the oath of office in a private ceremony.
In a White House statement, Obama praised Kerry as "a champion of American global leadership."
"John has earned the respect of leaders around the world and the confidence of Democrats and Republicans in the Senate, and I am confident he will make an extraordinary secretary of State," Obama said.
Obama's nominee for secretary of Defense, Chuck Hagel, has his confirmation hearing Thursday. Unlike Kerry, the former Republican senator from Nebraska is expected to face considerable opposition in the Senate.
A spokesman for Cornyn said Kerry supported liberal positions that most Texans opposed. Cruz has criticized Kerry, a decorated Vietnam combat veteran, as anti-military.
Earlier Tuesday, Kerry received the unanimous endorsement of the Senate Foreign Relations Committee in a voice vote. He served on the committee for 28 years and was chairman for the last four.
Sen. Bob Corker (R-Tenn.), the ranking Republican on the committee, praised Kerry as a "realist" on foreign affairs issues, and said he had always been "open to discussion" with members of the other party.
Several Republican senators had promoted Kerry for the job as an alternative to Susan Rice, the U.S. ambassador to the United Nations. Rice withdrew her name from consideration amid mounting Republican criticism of her statements on TV talk shows after the deadly Sept. 11 attacks on the U.S. mission in Benghazi, Libya.
Kerry faces formidable challenges in his new job.
Obama's first administration made little headway at solving foreign policy problems in Iran, Syria, North Korea and elsewhere. Kerry also will deal with a White House that prefers to keep decisions on key issues of war and peace in its own hands.
During his confirmation hearing last week and other appearances, Kerry gave some signals of what he intends to emphasize.
He said he would begin an effort to renew Israeli-Palestinian peace negotiations, a process that has been nearly dead since the Obama administration's opening initiative was abandoned two years ago.
Kerry also said he intended to work toward preventing global warming. The momentum of that effort also slowed in Obama's first term.
His resignation from the Senate starts the clock on a special election in Massachusetts to fill his seat until his term expires in January 2015. Gov. Deval Patrick, a Democrat, is expected to call the election on June 25.
Patrick will name an interim senator to serve until voters go to the polls. Possible candidates include Victoria Reggie Kennedy, widow of the late Sen. Edward M. Kennedy; and former Rep. Barney Frank, who has publicly expressed interest in the temporary posting.
Former Republican Sen. Scott Brown, who lost an expensive 2012 reelection bid against Democrat Elizabeth Warren, has yet to signal whether he will run again. He is said to be considering a 2014 campaign for governor.
As Kerry moved toward his new role, Clinton did a final televised group interview with students and journalists at locations around the world. She was asked whether she intended to run for president in 2016.
"I right now am not inclined to do that," she said. Her immediate priority, she said, was "catching up on about 20 years of sleep deprivation."