In Tuesday's vote, Jansa was backed by 52 MPs, while 31 were against and one ballot was invalid, parliament said in a brief statement on its website.
A total of 84 MPs were present in the 90-seat chamber for the vote.
Last week, president Borut Pahor proposed to parliament to appoint Jansa as prime minister, following the resignation of Marjan Sarec and his coalition government of five parties in January.
Jansa already held the post of prime minister in 2004-2008 and in 2012-2013. He has been at the helm of SDS since 1993.
According to a report by state news agency STA, Jansa's SDS party has joined forces with the social-liberal Modern Centre Party (SMC), conservative New Slovenia-Christian Democrats (NSi) and Democratic Party of Pensioners of Slovenia (DeSUS) to form a new government.
SMC and DeSUS were part of Sarec's outgoing cabinet, which was sworn in September 2018 as Slovenia's first minority government. It was formed after SDS won a snap vote in June but failed to attract partners to form a cabinet.
The outgoing coalition was made up of representatives of Sarec's centre-left LMS, SMC,DeSUS, the Social Democrats (SD), and the Alenka Bratusek Party (SAB).
Sarec resigned on January 27 over disagreement between his health and finance ministers on scrapping supplementary health insurance in the country.
According to the latest opinion polls carried out in early February, SDS is favourite to win the general elections in the country if they were held now, with 18.3% support, ahead of Sarec's LMS party that would rank second with 17.2%.