RICHMOND -- Chevron's five year-plus quest to initiate a $1 billion upgrade to its century old refinery, the largest in Northern California, was approved by a divided City Council late Tuesday after the company and city staff hammered out a last minute deal upping community investments and installing safety and piping upgrades as part of the project.

The vote passed 5-0, with two abstentions, and triggered a raucous applause from the crowd.

Last minute concessions by the oil company appeared to pave the way for approval. Among the changes, which were distributed to the council hours before the meeting, were $90 million in community investments over the next decades and agreements to upgrade all carbon steel piping in the refinery's crude unit that could be susceptible to higher sulfur crude by 2017 and install more sensors and air monitors.

"It became clear we would need to do this," refinery General Manager Kory Judd said of the concessions. "We knew the city and the community would hold us to a higher standard (but) this puts a significant constraint on our operations."

Pressure has mounted in recent weeks in favor of the project. Councilman Jim Rogers said Rep. George Miller, D-Martinez, called him and his colleagues to express his favorable view of the refinery modernization.

"First time George Miller called me in 30 years," Councilman Tom Butt wrote on Facebook during the meeting.

After months of anticipation, the City Council was set Tuesday to rule on the conditions of Chevron Corp.'s $1 billion refinery modernization project.

A split City Council weighed whether to uphold the oil giant's appeal or side with the city's Planning Commission, which ruled last month that Chevron's project should include a series of additional conditions. Those include requirements for new piping throughout the refinery, $8 million per year until 2050 in community investments in green energy programs, and steeper reductions on a range of emissions.

Chevron appealed the commission's recommendations to the council, and the council's own staff and consultants sided with Chevron.

Tuesday's meeting was a continuation of a July 22 hearing, at which over 200 members of the public signed up to speak about the project. More than 100 were still waiting when the council recessed.

Like the July 22 hearing, Tuesday's meeting was held at the Richmond Memorial Auditorium because of the large expected crowd. More than 600 turned out.

Jennifer Hernandez, the lead environmental review attorney retained by the city to analyze Chevron's project, said health risks in the community would decrease with the project.

"The risks go way down," Hernandez said.

But environmental groups disagreed, noting that some categories of emissions will go up although overall greenhouse gases will be capped.

"We don't agree that the health risks will decrease, there is disagreement on that," said Roger Lin, lead attorney for Communities for a Better Environment. "Some toxic air contaminants are not capped."

The main project components include replacing a 1960s-era hydrogen plant with more modern technology. The modernization would give the refinery flexibility to process crude oil blends, including those with higher levels of sulfur, according to Chevron.

Opponents say the project does not go far enough in limiting pollution and upgrading safety at the facility, and say the company should give more than the planned $90 million over 10 years in community investments.

Chevron officials, employees and many residents implored the City Council to accept the project without the Planning Commission's additional conditions.

Chevron officials last week reversed their previous position and agreed to a condition, dubbed Alternative 11, that caps greenhouse gas emissions and reduces sulfur-processing levels. The office of state Attorney General Kamala Harris, which originally complained that the project did not go far enough to limit emissions, has stated its support of Alternative 11.

Chevron also announced that it would increase its community investments into local nonprofits and green jobs programs from $30 million to $60 million over the next decade. In the package approved Tuesday, the number swelled to $90 million, including money for college scholarships for local kids and donating land for a solar panel field.

In its agenda report, city staff and consultants supported Alternative 11 and recommended the council reject the Planning Commission's recommendations on grounds that they are not legal and are "factually contradicted by substantial evidence on record."

But activist groups and others urged council support of the commission's recommendations. They also cautioned the council to remember the refinery's history of accidents and the health and environmental consequences, including a massive fire in August 2012 that sent thousands of residents in search of medical treatment.

More than 70 speakers addressed the council Tuesday, ranging from calling on Chevron to close to urging the council to stop meddling in its affairs.

Several expressed dissatisfaction that no money was included for Doctors Medical Center in San Pablo, the largest emergency room in the area and the one that treated most of the people who sought treatment after the 2012 fire. The hospital is expected to close or be drastically downsized due to financial troubles.

Vice Mayor Jovanka Beckles floated a motion to give DMC $27 million and support the Planning Commission's more stringent emission requirements, seconded by Mayor Gayle McLaughlin. Hernandez said there was no "legal nexus" to require the refinery to fund the hospital because the project would make the facility safer. The motion failed with the other five members dissenting. Both McLaughlin and Beckles abstained from the final agreement that passed. Beckles called the lack of money for the hopital, "horrible."

Butt said in his negotiations with Chevron, the company was unwilling to infuse the hospital with immediate funds to stave off closure.

Council approval does not clear the way for Chevron to begin construction, however. The company said it will have to return to a Contra Costa County court that halted a previous version of the project in 2009 to get that judgment lifted.