Union officials announced the deal, which still requires approval from union members, then from the Bay Area Rapid Transit's board of directors.
BART spokeswoman Alicia Trost said limited service would begin Tuesday at 4 a.m. on all lines. BART officials hoped trains would be running at full strength in time for the afternoon commute.
BART is the nation's fifth-largest rail system, with an average weekday ridership of 400,000.
Workers walked off the job on Friday after talks broke down. Commuters endured jammed roadways and long lines for buses and ferries, as they looked for alternate ways around the region.
The talks between BART and its two largest unions dragged on for six months- a period that saw two chaotic dayslong strikes, contentious negotiations and frazzled commuters wondering if they would wake up to find the trains running or not.
"The public expects us to resolve our differences and to keep the Bay Area moving," BART general manager Grace Crunican said Monday night.
Crunican said there would be no immediate announcements on the details while union leaders explained the agreement to their members, but she said it was a compromise and added: "This deal is more than we wanted to pay."
Negotiations resumed and a settlement was reached just two days after two track workers were killed in a BART train accident in Walnut Creek. Federal investigators said Monday that the train was run by a BART employee who was being trained to operate trains. Union officials had warned that training managers to operate trains during the walkout could be dangerous.
"This is a reminder, this weekend, that this is about people," said Lt Gov. Gavin Newsom, who joined BART and union officials to announce the settlement.
Of the strike, he said, "This has got to be the last time this happens."
Antonette Bryant, president of the Amalgamated Transit Union Local 1555, expressed her condolences Monday night to the families of the workers who were killed.
"We did not want to strike," she said, "and we are glad to have a tentative agreement that we feel will work for all parties."
The key issues in the negotiations were salaries and worker contributions to their health and pension plans.
Talks began in April, three months before the June 30 contract expirations, but both sides were far apart. The unions initially asked for 23.2 percent in raises over three years. BART countered, offering a four-year contract with 1 percent raises contingent on the agency meeting economic goals.
The unions contended that members made $100 million in concessions when they agreed to a deal in 2009 as BART faced a $310 million deficit. And they said they wanted their members to get their share of a $125 million operating surplus produced through increased ridership.
But the transit agency countered that it needed to control costs to help pay for new rail cars and other improvements.
BART and its workers all but agreed on the typically contentious contract issues of wages and benefits. Then a deal fell apart, and workers went on strike Friday for a second time.
The main sticking point was work rules, which can be anything from how schedules are made and how grievances are handled to how paychecks are distributed and whether reports are written electronically or in longhand. For workers, stricter rules create stability in their assignments and how they do their jobs. For managers, they limit how flexibly and efficiently they can run the system.
Some of the biggest work-rule changes BART sought relate to work shifts and worker protections.
For example, BART wanted to be able to change work schedules with greater ease; the unions wanted to preserve schedules such as a 4-day, 10-hour week, saying this would help workers with child care and other obligations. Other proposed changes would have affected the handling of worker claims of discrimination or harassment by managers.
BART workers also walked off the job in early July, shutting down train service for nearly five days.
Thanawala reported from San Francisco. Associated Press writers Haven Daley and Terence Chea in Walnut Creek contributed to this report.