(Adds comment from Zavala)
LIMA, June 23 (Reuters) - Peruvian Prime Minister Fernando Zavala was sworn in as finance minister on Friday, taking on the twin tasks of reviving the faltering economy and defusing hostilities with the rightwing opposition that toppled the outgoing finance minister.
Centrist President Pedro Pablo Kuczynski appointed Zavala to manage the economy of the world's second-biggest copper producer while keeping him in his post as prime minister. A government source who spoke on condition of anonymity said on Thursday that Zavala would only head the finance ministry temporarily.
Zavala, a 46-year-old former executive at brewer SABMiller, served as finance minister in 2005 and 2006 when Kuczynski was prime minister and is a widely respected economist with a diplomatic style.
"Wishing the best for Minister Zavala for the good of our country," opposition lawmaker and president of Congress Luz Salgado told Zavala on Twitter in a rare cordial exchange.
The cabinet shuffle caps weeks of mounting friction with the opposition-controlled Congress that ousted the outgoing finance minister with a vote of no-confidence over accusations he tried to pressure the comptroller to approve a controversial contract.
Markets in Peru, where a free-market economy has been in place for the past quarter of century, have remained stable. But Kuczynski's political vulnerability threatens to disrupt his ability to govern effectively in the remaining four years of his five-year term.
Kuczynski's party has just 17 seats in the 130-member Congress, while former electoral rival Keiko Fujimori's rightwing populist party controls 72. Four ministers, including two of Kuczynski's closest advisers, have already stepped down amid controversy since he took office.
The political strife comes as economic growth in Peru, one of Latin America's most robust economies, has slowed sharply as the fiscal deficit widens following a graft scandal involving Brazilian builder Odebrecht and destructive flooding.
"It's a challenging time. But we can face it. Let's all work together," Zavala said on Twitter. "First tasks: (economic) reactivation, employment, and accelerating public investment."
Kuczynski's decision to task Zavala with running both the finance ministry and the cabinet suggests Kuczynski does not have a pool of trusted economists to draw from, said Pedro Tuesta, the chief Latin American analyst for 4Cast-RGE.
"It says a lot about the lack of candidates," said Tuesta.
Kuczynski, a 78-year-old former Wall Street banker, took office with promises to cut taxes and bolster infrastructure projects to jumpstart domestic demand.
The central bank expects a 2.8 percent economic expansion this year, down from 3.9 percent in 2016. (Reporting by Mitra Taj; Editing by Cynthia Osterman and Sandra Maler)