Lenox Hill and Park Slope top New York City’s most bike-friendly neighborhoods, according to a new analysis from StreetEasy.

The real estate site crunched data weighing access to parks and greenways, density of bike lanes and Citi Bike docks, and apartment listings with bike storage to compile its findings just in time to honor Bike to Work Week, which began Monday and ends Friday.

Battery Park City ranked third, with the Upper East Side and Midtown West rounding out the top five.

“There were definitely a couple of surprises on the list,” said Lauren Riefflin, a spokeswoman for StreetEasy, referring to Manhattan locations such as Lenox Hill topping the ranks. “Usually, those dense commercial areas are no-fly zones for cyclists because of all the traffic. But it really says a lot about the improvements the city has made in bike infrastructure in recent years.”

Jorge Gallegos, a laboratory technician from Park Slope, could see why his area would take second place.

He touted the protected bike lane on Prospect Park West as he rode it Thursday with his wife. His two young children were mounted on bike seats — one over the back wheel and the other over the front handlebars.

“The protected bike lanes are very safe — it’s that distance and separation from the cars that really helps,” said Gallegos, who said he bikes for both recreation and to commute. “Especially in the summer, you can ride and save money while getting some exercise at the same time.”

The neighborhood’s 12.68 miles of bike lanes, 26 Citi Bike docks and Prospect Park access helped lift Park Slope to the No. 2 slot. It also features 531 sales and rentals with bike storage.

The analysis doesn’t include other data, such as traffic crashes involving cyclists, and more difficult-to-quantify issues, such as pedestrian crowding, which is especially problematic for some riders in areas such as Midtown West.

Without enough space for pedestrians there, the bike lanes aren’t much help, according to bike courier Kainoh Torres, who was riding down Second Avenue, through Lenox Hill, on Wednesday.

“On lanes like Eighth Avenue, in the 30s, I try to avoid the bike lane as much as possible,” said Torres, who lives in Bedford Stuyvesant and has worked as a courier for eight years. “There are so many pedestrians they just walk in the lane.”

Still, he said the city’s gotten much more accommodating to cyclists since he first took to its streets.

“It was a little crazier, for sure,” Torres said. “But now, you still have to watch out for that human element with all the people here.”