The battle between Uber and Lyft is heating up, both on and off Big Apple streets.

Three months after Lyft opened its first permanent office in the city, Uber has doubled down on its Gotham operation, signing a lease for its second Manhattan headquarters — a 35,000-square-foot space at 38th Street and Broadway.

The office will primarily house its burgeoning New York engineering team, the company said.

Over the past two years, the number of Uber engineers in the city has grown to more than 150.

The company already occupies a 54,000-square-foot space in Chelsea with views of the Hudson River.

The San Francisco-based ride-hailing giant is aiming to double the size of that team to more than 300 before 2020, it said.

“New York City has become the tech hub of the East Coast and we are excited to expand our engineering footprint here,” Uber director of engineering Marc Donner told The Post. “With this new space, we plan to grow our engineering office and attract the top talent in the city.”

Uber, which dominated the headlines in recent weeks due to its high-profile court battle with Google-owned Waymo over trade secrets, has had a presence in New York City since 2011.

On Friday, it settled the $2 billion suit Waymo filed against it. Under the settlement, Waymo will get a $245 million stake in Uber.

In addition to Uber’s Chelsea headquarters and soon-to-come Midtown office, the company has three Greenlight Hubs for drivers — in Long Island City, the Bronx and Brooklyn.

The expansion comes as Mayor Bill de Blasio has announced plans to revive his failed bid to regulate companies like Uber following the suicide of a livery driver in front of City Hall last week.

“We have to come back and look at what is a single, comprehensive vision for the future of our for-hire vehicle sector that can make sense to everyone involved,” de Blasio said on WNYC radio.