With a population of only 667,000, Boston fits somewhere in size between the Bronx and Staten Island, New York City’s smallest boroughs. But a comparison of apartment rents shows the Massachusetts state capital punches well above its weight.

So much so that Bostonians, just like New Yorkers, gripe about the lack of affordable apartments in their city. Blessed with a thriving economy, world-class institutions of higher education, as well as historic, walkable neighborhoods, Boston is affluent and desirable. Desirable enough that Boston ranks just behind San Francisco and New York City as home to the nation’s most expensive rentals, according to the real estate website Zumper.

RELATED: Live in a trendy Philly neighborhood for less than Staten Island

A sampling of neighborhoods in both cities by NeighbrhoodX, a real estate research and analytics start-up, shows more similarities than differences in rent prices, especially if one gets past a few of New York’s ultra-pricey neighborhoods.

Construction cranes are a fixture in downtown Boston, which contains some of that city’s most historic sites as well as its centers of business, government and shopping. The median one-bedroom rental goes for $3,300 per month, putting the neighborhood well below one of New York City's priciest neighborhoods, Tribeca, where median one-bedroom rents are $4,700. Downtown Boston is still above one of Brooklyn's trendiest areas, Williamsburg, which has a median one-bedroom rent of $2,900.

Not far away from downtown is Beacon Hill, one of Boston’s oldest neighborhoods. Filled with handsome Federal style homes built most in the early 1800s and just across the street to the Boston Commons and Public Gardens, the median rent is $2,500. New York townhouse neighborhoods include brownstone Brooklyn Heights and Chelsea, which fetch $3,100 and $3,800 per month, respectively, though rents in the latter have been pushed up dramatically by recent high rises.

And speaking of brownstones, Boston has Back Bay, which shares more than a few similarities to Brooklyn Heights. Both were developed in the late 1800s and feature elegant townhouses, front stoops and gardens. Back Bay also has Newbury Street, an eight-block commercial stretch. (New Yorkers should think Madison Avenue, but with restaurants featuring outdoor dining.) The median rent there is $2,800 for a one bedroom.

One addition to Beantown’s high-rent districts might shock old-timers. South Boston’s D Street/West Broadway has sprouted pricey housing, part of the spillover from a major redevelopment of nearby underused piers and industrial land. Located across a channel from downtown Boston, a one bedroom in this section of “Southie” rents for $3,000. The figure for similarly situated Long Island City, which is undergoing a major redevelopment also, stands at $2,900.

Like New York, Boston has its more affordable neighborhoods, but as is usually the case, one pays for that with greater distance from the city’s downtown. Further south, Dorchester is the city’s largest neighborhood and perhaps its most ethnically diverse. One of Dorchester’s commercial centers is Upham’s Corner, where the median one-bedroom rents for $1,600. New York neighborhoods comparable in price are Woodside in Queens, $1,800, Sheepshead Bay in Brooklyn, $1,700, and Mott Haven in the Bronx, $1,500.

Not far from downtown is Boston’s West End, a neighborhood of high-rise apartment buildings that have risen out of urban renewal demolition of the 1950s.

Though it lacks the historic architecture the city’s close-in neighborhoods, it does have convenience — and a median one-bedroom rent of $3,000, about the same rent as in Brooklyn Heights or Long Island City.