The developer of the San Francisco Tennis Club property South of Market has agreed to build 12 underground tennis courts and invest money into public recreation facilities in a last-minute deal with club members to prevent a ballot fight in November.

Alexandria Real Estate Equities and TMG Partners, which have proposed a 2.6-acre, mixed-use office complex on the site at Fifth and Brannan, will construct a subterranean tennis center beneath the proposed 870,000-square-foot office building. In addition, the developer will pay to resurface 24 unidentified public tennis courts and contribute an undisclosed amount of money to build public recreation sites. Sources put the amount at more than $1 million.

Quick negotiations

The compromise comes after a group of recreation advocates, led by tennis club members, gathered 19,000 signatures, more than twice the number needed to get a measure on the ballot. The ballot measure, called “Don’t Demolish Recreation in San Francisco,” would have required any property owner knocking down a public or private recreation center to replace it with a site of similar size and within three-quarters of a mile of the original. The San Francisco Tennis Club has 24 courts, 12 indoors and 12 on the roof.

With early polling indicating that San Francisco voters were inclined to support the measure, the developer was motivated to make a deal to avoid the electoral showdown, which would have been expensive and could have killed the project. The tennis club members, on the other hand, were not looking forward to a campaign in which they would probably have been significantly outspent.

“Both parties moved quickly once they came to the negotiating table,” said Supervisor Jane Kim, who helped broker the deal. “For the most part people were reasonable and interested in a compromise. There were not unrealistic expectations set on either side, which was a concern of mine.”

Tricia Weaver, a tennis club member who helped organize the ballot initiative, said the deal “meets our goals of preserving sports and recreation in the city.” She said the group will withdraw the ballot measure.

“It was the 19,000 signatures that caught their attention,” Weaver said. “In the end, we proved that the community can work together to achieve a mutually beneficial compromise.”

The new underground tennis center will have a gym, cafe and meeting rooms — everything the current club has, although it won’t have the 12 rooftop courts, Weaver said.

The 2.6-acre site is one of the largest development sites being rezoned for increased heights and density under the city’s Central SoMa Plan, which is meant to add more than 4,000 housing units and 5.3 million square feet of office space along the new Central Subway line, set for completion in 2019. The tennis club parcel, along with the San Francisco Flower Mart at Sixth and Brannan streets, is one of the largest pieces of land being rezoned.

‘A fantastic outcome’

With the new tennis courts, it’s now unclear whether other aspects of the development will change. The most recent plan filed with the city would contain 870,000 square feet of office space; 52,000 square feet of space for production, distribution and repair, known as PDR; and 30,000 square feet of retail, of which 16,000 square feet would be a fitness center.

An early proposal by the developer to cut about 9,000 square feet of the property to be dedicated to the city for affordable housing remains in the project.

Tennis club member Seth Socolow, who was involved in the talks with Alexandria Real Estate, called the deal “a fantastic outcome for everyone involved.”

“We started with a self-serving interest in protecting the club, which is a second home to me,” he said. “We ended with a much broader coalition of people interested in standing up to protect public and private recreation facilities.”

Tennis club members will consult on the design of the new club. Socolow said he emphasized the importance of having ceilings high enough to hit a proper lob.

“Any real estate developer is looking for an anchor tenant,” he said. “Now they have the basement rented out.”

J.K. Dineen is a San Francisco Chronicle staff writer. Email: jdineen@sfchronicle.com Twitter: @sfjkdineen