The June train strike hit tens of thousands of passengers, mostly in southern Sweden, but as far north as Gothenburg and Uppsala.
On Wednesday night, however, union heads and employers accepted the offer put on the table by mediators.
A spokesman at the Seko union called the agreement a 'historic victory' for the unions.
The strike was launched after around 250 workers, from ticket collectors to drivers, were effectively fired and rehired on temporary contracts, meaning that they were unsure if they would get any work at all.
The deal does not include any limit on hourly employees, which was one of Seko's key desires. However, such employees will be given a pay increase so significant that it makes it practically pointless for the companies not to employ them full-time.
The chief negotiator of employers' organization Almega, Beata Hammarskiöld, said Wednesday night that she was not entirely satisfied with the agreement.
"It can have consequences such as a recently-graduated 19-year-old getting a higher salary than a full-time employee who has been working there for 40 years," she said.
The first train back in action will leave Malmö for Gothenburg at 1pm on Thursday. Traffic over the Öresund bridge to Denmark will not be resumed until Friday afternoon.
The strike has cost traffic corporations 15 million kronor ($2.3 million) per week, losses which may still affect future ticket prices. Seko and employers' organization Almega have met on multiple occasions to negotiate but had a nearly three-week stalemate.
The Seko union began the strike on June 2nd.