Target Corp. on Wednesday opened its first flexible format store in the New York boroughs, in Forest Hills, Queens. The 21,000-square-foot unit on two levels is the first of six flexible format locations slated to open in the New York metro area this fall.

The retailer’s first flexible format store in Manhattan, a 45,000-square-foot unit featuring a Chobani Café, is scheduled to bow in October in TriBeCa.

A 120,000-square-foot flexible format unit will open at City Point in Brooklyn and smaller units are set to be unveiled in Elmont and Freeport, N.Y., and Closter, N.J. in the fall.

Target has been doing business in four of the five boroughs for six years. The retailer has also exposed itself to New Yorkers by engineering events such as a pop-up shop for its partnership with Missoni in 2011, a takeover of Bryant Park for its Lilly Pulitzer collection in 2015.

For its Marimekko collaboration, Target in April peppered the High Line with different activities housed in structures covered with the Finnish fabrics.

While it’s taken Target more than a decade to open its upcoming store in downtown Manhattan — after first testing the waters with a pop-up Target boat at the Chelsea Pier in 2002 — its foray into the five boroughs has been less fraught than those of competitor Wal-Mart’s.

The world’s largest retailer was defeated in 2006 in its initial expansion push in New York, then went on the offensive, seeking potential store locations that didn’t require zoning changes and approval by the 51-member city council.

A potential deal at the Gateway II development in Brooklyn fell through in 2013 and the retailer appeared to retreat from the five boroughs — after spending $1.8 million on ads in the New York market.

Mayor Bill de Blasio, who was an outspoken Wal-Mart opponent as a city councilman, in 2014 publicly said Wal-Mart stores don’t belong in the city.

“I don’t think it is a state secret that I am very uncomfortable with Wal-Mart,” de Blasio said. “I have been adamant that I don’t think Wal-Mart — the company, the stores — belong in New York City and I continue to feel that.”

Wal-Mart has ringed the city with stores in Bayonne, Kearney and Secaucus, N.J., and White Plains and Valley Stream, N.Y. The company cited the city’s residents’ expenditures of more than $215 million in 2012 at Wal-Mart stores in New York’s suburbs, as evidence of the demand.

A Wal-Mart spokesman did not reply to an e-mail seeking comment.

New York’s unions have been vocal opponents to Wal-Mart, although that doesn’t entirely explain the retailer’s difficulty and Target’s relative ease in breaking into the city. Target’s first Manhattan store opened at East River Plaza in 2010. The retailer has also unveiled stores in East Harlem and Atlantic Terminal in Brooklyn.

The new Forest Hills Target stocks local products made in the community or geared to area residents. For example, local sports team apparel and accessories and Local Pride by Todd Snyder, a collection designed specifically for Target’s New York City stores.

In addition, the store has a pharmacy; fresh grocery with grab-and-go food options; basic apparel such as T-shirts, tanks and C9 activewear for men and women; health and beauty products, and tech accessories, tablets and mobile phones.

Target’s flexible-format stores originally were called City Target and Target Express. The first Target Express opened in July 2014 near the University of Minnesota campus in Minneapolis and was designed to carry about 15 percent of the products in a SuperTarget.

Chairman and chief executive officer Brian Cornell last year decided to eliminate the City Target and Target Express designations and streamline the stores under one moniker — Target.