Forty-five deputies in the 90-seat parliament voted in favour of the new cabinet, 34 were against, while 11 abstained from the vote or were absent.
Šarec, a former provincial mayor, comedian and actor, became prime minister-designate last month after the centre-right Slovenian Democratic Party (SDS) failed to forge a coalition despite winning most votes in June's election.
"We have proved that we can talk ... now it is time to start working... and deliver results," Šarec, 40, told parliament ahead of the vote.
The new government would be "a guarantee for a stable economic environment that is kind to investment". He added improving the national health system and cutting red tape would be priorities.
His List of Marjan Šarec (LMŠ) party is in coalition with four other centre-left parties: the Social Democrats, the Party of the Modern Centre, the Party of Alenka Bratušek and the pensioners' party Desus.
They account for 43 of parliament's 90 seats. The opposition Left party, which has nine seats, has pledged to support the minority government on key policies.
Outgoing premier Miro Cerar is the new foreign minister, replacing Karl Erjavec who became defence minister. Economist Andrej Bertoncelj takes the finance portfolio.
Analysts say the minority government might struggle to stay in power for a full four-year term.
Otilia Dhand, senior vice president of US advisory firm Teneo Intelligence, said the coalition parities had disparate priorities so there was a high risk the coalition could collapse and spark early elections.
Opposition leader Janez Janša, who heads the SDS, told parliament before the vote: "Every day in which this government has executive power in the country will be a day of lost opportunities for Slovenia."
Predlogi
Ni najdenih zadetkov.
Rezultati iskanja
Rezultati iskanja
Rezultati iskanja
Rezultati iskanja
Rezultati iskanja
Rezultati iskanja
Rezultati iskanja
Rezultati iskanja