Image caption Porsche and Volkswagen have been trying to find ways to speed up their merger

Volkswagen says it has agreed a deal to buy the remaining 50.1% stake in Porsche it doesn't already own by the start of next month.

VW will pay 4.46bn euros ($5.6bn; £3.6bn) plus one VW common share to acquire the stake.

The two firms had agreed in 2009 to merge by the end of 2011, but have since faced legal obstacles.

The deal is likely to reduce costs and boost VW's earnings as it seeks to become the world's biggest carmaker.

"The accelerated integration will allow us to start implementing a joint strategy for Porsche's automotive business more quickly and to realise key joint projects more rapidly," said Hans Dieter Poetsch, chief financial officer of Volkswagen.

'A great deal'

It's a great deal for Volkswagen, both financially and in operative terms David Arnold, Credit Suisse

Both the firms had been seeking to accelerate the merger. However, one of the stumbling blocks for the deal was the likelihood of a big tax bill for both the firms.

Volkswagen had acquired a 49.9% stake in Porsche in 2009.

According to various reports, if it bought the remaining stake before 2014, the two companies may have had to pay more than 1bn euros in taxes, making the move less attractive.

Analysts said that by structuring the deal as one which involved the payment of one VW common share to Porsche, the firms may be able to avoid that bill.

They said that such a move means that the deal may see it being classified as a restructuring of the company rather than a takeover.

"It's a great deal for Volkswagen, both financially and in operative terms," said David Arnold, an analyst with Credit Suisse.

Meanwhile, Volkswagen said in a statement that "the accelerated integration model that has now been agreed can be implemented on economically feasible terms".

Role reversal?

Once completed, the deal will bring an end to one of the most dramatic takeovers in the car manufacturing industry.

Porsche had been trying to take over Volkswagen for many years.

Its attempt failed in 2009 as it fell short of acquiring the required 75% stake.

The global financial crisis and the slump in the global automotive sector made it difficult for the carmaker to raise enough money to buy the required stake.

But none the less, Porsche accumulated large amounts of debt in the process and was sued by investors who accused it of misleading them.

In a turnaround of events, the firms agreed a deal in 2009 under which Volkswagen agreed to take over Porsche.