Amazon can build twin 22-story headquarters buildings in Pentagon City, the Arlington County Board agreed Saturday in a 5-to-0 vote after the online giant promised $20 million in funding for affordable housing and vowed to crack down on labor fraud on its construction site.

It was the final approval Amazon needed to begin building its second headquarters, known as HQ2, in Arlington County, and it came after a four-hour hearing in which the only friction was provided by about 100 union carpenters and building trade workers upset by what they said was payroll fraud on the part of contractors and subcontractors working on the company’s temporary headquarters.

HQ2 is expected to be completed by 2023 and could transform the district, which is largely made up of high-rise residential buildings and low-rise warehouses, into a new center of urban life just across Interstate 395 from the Pentagon.

The 2-million-square-foot headquarters, at the parcel containing 1400 S. Eads St. and 501 15th St. South, will house about 12,500 employees — half the expected 25,000 Amazon employees who will eventually work in the area. Hundreds of employees are already working in leased offices around Crystal City. Another Amazon headquarters building in the neighborhood is working its way through the planning process and is most likely to come up for approval next year. (Amazon founder and chief executive Jeff Bezos owns The Washington Post.)

Negotiations between the county and the company for the Eads and 15th Street locations, called Metropolitan Park, were necessary because the site had been zoned for residential use and Amazon sought to add about 590,000 square feet of density to 1.56 million square feet that was already permitted.

The $20 million commitment for affordable housing is the largest single infusion of money into Arlington’s housing fund.

Amazon also promised to open a 160-slot day-care facility for use by both employees and other Arlington residents on a first-come, first-served basis; spend about $14 million to expand an existing public park tucked between high-rises into a two-acre public plaza and to pay for its maintenance in perpetuity; create two highly energy-efficient structures that will be 100 percent powered by renewable energy by 2030; build two new protected bike lanes; devote its 69,545 square feet of ground-floor space to a “curated” selection of retail shops; and provide a 700-person-capacity indoor event space for county-sanctioned events at least four times a year. An underground garage will have 1,933 spaces, and workers will be encouraged to use mass transit, company-provided van pools, bikes and scooters — or walk to work. Additional transit and transportation improvements in the area were also promised.

The outcome of the board’s vote was never really in doubt, because Arlington officials and most residents welcomed the company’s announcement 13 months ago that it had selected the area including Pentagon City, Crystal City and Potomac Yard as the home for HQ2.

But union carpenters filled the hearing room to protest, alleging payroll fraud and misclassification of workers who are renovating existing structures for Amazon’s temporary quarters.

Amazon promised earlier this week to require that contractors and subcontractors working on its headquarters pay the same local prevailing wages to laborers and mechanics they would have to pay if it were a federal contract in excess of $2,000. The company also said that contractors and subcontractors could not employ independent contractors without Amazon’s approval, and that they would be subject to oversight by a third-party labor compliance firm.

Stephen Courtien, executive director of the Baltimore-D.C. Building Trades union, said the proposal is “a good idea, but nothing they discussed is very innovative. It comes down to the contractor, and he’s self-reporting. They’re not going to know who’s on the job, off the books.”

County Board members, several of whom have been supported by unions, urged the company to pay close attention to the problem, and decried the fact that they cannot require a project labor agreement on major construction projects, because of Virginia’s policy of reserving all such decisions to the General Assembly. At least one bill submitted for the 2020 legislative session would rectify that; state Sen. Adam P. Ebbin (D-Alexandria) announced Friday night that his proposal would allow three Northern Virginia local governments to make such changes.

“A company that is built on innovation should not be used by low-road actors that use tired, old-school tactics [to hurt workers],” County Board Chair Christian Dorsey (D) said after praising the plans for its architecture, energy-saving plans and community benefits. The affordable housing contribution, given in exchange for higher density, is “substantial,” he said. “It’s not all the way there, but it’s much better than where we started.”

John Schoettler, Amazon’s global vice president of real estate and facilities, said that as soon as he became aware of the labor abuses he fired the general contractor and subcontractors involved, and will not hire them again.

“This is absolutely not acceptable to us whatsoever,” he told the five-member County Board, which is composed of Democrats. “I’ve made it abundantly clear that I will tolerate absolutely none of this going forward and people on my team will be held accountable.”

Saturday’s meeting was in stark contrast to a rowdy March 16 hearing, in which protesters shouted “shame” and forced the County Board to twice leave the room before it approved $23 million in incentives to the company. This time, just 20 people spoke, about one-fifth of the number from the spring, and the four hours that the board spent on the project was the equivalent of lightning speed for an Arlington site plan of this magnitude.

Many of Arlington’s citizen advisory boards and nearby civic organizations lined up behind the proposal with minor caveats. Both the Arlington Chamber of Commerce and a three-month-old Northern Virginia Economic Development Alliance, which represents 10 agencies that seek to promote the region, offered strong support.

That group said the Amazon development will result in more than 47,000 new direct and indirect jobs whose benefits will be felt across Virginia.

After the meeting, Schoettler said, “the community was awesome and helped us improve our plans.” He called the labor abuse “very unfortunate, but we took decisive and swift action. We intend to lead by example.”