The choice of the 54-year-old was all but certain as it was her turn among the seven-member Federal Council, or government, to take the rotating one-year presidency.
But she won a relatively high number of votes, 181 out of 236 ballots cast, underlining strong support across the country's political divides.
Sommaruga, who will replace outgoing president Didier Burkhalter, joined the government in 2010 as part of the first majority female cabinet in Switzerland.
She is a Social Democrat who successfully campaigned against a proposal for a 0.2 percent annual cap on net immigration, which she called xenophobic and which voters rejected in a referendum on Sunday.
Sommaruga argued that the Swiss economy would be hurt by such tight restrictions because it depended, in part, on skilled workers from abroad.
She has also championed reforms of public services and is a strong advocate of equal pay between men and women.
Born in Zug, she grew up in the canton of Aargau, attended the University of Fribourg and trained as a pianist in Lucerne, California and Rome.
She joined the Swiss Consumer Protection Foundation lobby group in 1993, later becoming its president.
Sommaruga began her political career as an MP in the canton of Bern before winning election as an MP to the national house of representatives in 1994 and the senate (upper house) in 2003.
After her election in the lower house of parliament, she made her acceptance speech in Switzerland's four national languages — German, French, Italian and Romansh.
She praised the country's system of direct democracy, where referenda are held regularly.
A system that valued compromise and respect was "a strength and not a weakness," she said.
"I will do everything to ensure that this political culture continues."
Sommaruga will take over on January 1st from Burkhalter, who is also foreign minister, to become Switzerland's fifth female president.
She is married to a writer, Lukas Hartmann.