The two sides have to negotiate an agreement on returning the striking workers to the Chicago-area plant, but a ratification vote is expected next week, said Dave Danko, president of USW Local 7-1, which represents the workers.

"We are pleased to have a tentative agreement in place at Whiting and will work towards getting our colleagues back to work as soon as possible," said BP spokesman Scott Dean.

Before the tentative pact can be considered for ratification, USW International Vice President Gary Beevers, who oversees the union's national oil bargaining programme, must verify that the proposal conforms to the terms of a national agreement reached by the USW and U.S. refinery owners, said Lynne Hancock, union spokeswoman.

After a ratification vote, it can take a week to two weeks before workers return to their jobs.

Danko said both sides compromised to make the tentative deal.

"The company moved in our direction and we moved in their direction," Danko said.

Talks had been stalled on the question of bargaining by the union during the term of the contract.

BP had said it wanted to limit the issues the union could bargain over so it could more quickly implement policy changes. The union had said it wanted language that would allow it to negotiate with the company over policies affecting workers on questions such as safety.

"We reached an agreement that allows the company to be competitive and preserves the language we wanted," Danko said.

Under the terms of the four-year national agreement, once a contract is ratified the workers are scheduled to receive a 2.5 percent pay increase in the first year of the pact, a 3 percent increase in each of the two following years and a 3.5 percent increase in the fourth year.

BP has kept the refinery in operation using temporary replacement workers.

(This version of the story adds the background and details)

(Reporting by Erwin Seba; Editing by Andre Grenon and Alan Crosby)