(Recasts with cost-cutting measures, S&P announcement)
BRASILIA, Aug 15 (Reuters) - Brazil's government loosened its budget targets for all years through 2020 on Tuesday, delaying prospects for a drop in the federal deficit after legislators repeatedly refused to raise taxes in the recession-hit economy.
Cost-cutting measures were announced along with the new targets, in a bid to demonstrate President Michel Temer's commitment to fiscal discipline even after his economic team cut forecasts for economic growth next year.
The revision, announced weeks earlier than expected, underscored the uphill battle for Temer to gather support for austerity measures as a corruption scandal simmers and next year's general elections approach.
Market reaction was muted as investors did not expect a surge in government spending despite the new targets. Ratings agency Standard & Poor's spared Brazil from a downgrade, saying after the announcement that it would maintain the country's debt rating at BB with a negative outlook.
Brazil's government set a new primary deficit target for this year and next of 159 billion reais ($49.7 billion), up from 139 billion reais this year and 129 billion reais for 2018.
The country will target a deficit of 139 billion reais for 2019, up from 65 billion previously. For 2020, it will aim for a 65 billion reais deficit compared with a 10 billion reais surplus previously - raising prospects of a seven-year-long period of consecutive budget deficits, started in 2014.
Brazil lost its investment-grade credit rating in 2015 after missing the goals for years. Temer, who replaced impeached President Dilma Rousseff in 2016, pledged to set realistic targets and meet them to regain credibility with investors.
Members of Temer's economic team, including Finance Minister Henrique Meirelles, previously wanted to wait until September to consider a looser budget target, but agreed to move up talks under pressure from a fractious coalition in Congress.
Most cost-cutting measures announced by Meirelles and Planning Minister Dyogo Oliveira on Tuesday will need Congress' approval. They include postponing public sector salary hikes by one year and reducing the entry salary for incoming civil servants.
Despite strong opposition to tax hikes, Meirelles said the government would still seek to roll back payroll tax breaks and would raise taxes on some investment funds.
The government did not announce expected infrastructure concessions. It forecast 2 percent growth in 2018, down from a previous estimate of 2.5 percent.
($1 = 3.196 Brazilian reais) (Editing by Lisa Shumaker and Andrew Hay)