Counties and cities have long competed to lure companies to invest and create jobs in their communities. Now the prosperous ones are vying to attract and retain young talent, especially in high-tech fields — because that’s what businesses today seek above all else.

Among them is Northern Virginia, which is putting together an ambitious program to market itself to educated, tech-oriented millennials and Gen Zers.

Both the recently created Northern Virginia Economic Development Alliance (NOVA EDA) and the Northern Virginia Chamber of Commerce have decided to make attracting talent their top priority.

Their projects are just getting started, but the mission is to spread the word that the area offers numerous lucrative job opportunities as well as cool places to live.

The goal is partly to lure a larger share of bright young minds to settle in the Washington area to work in industries of the future such as cloud computing, cybersecurity, artificial intelligence and biotechnology.

Another objective is persuading more of the young people leaving area universities and community colleges to remain in the region. The area loses more than half of such graduates each year to other parts of the country — partly because of high housing costs.

While other parts of the Washington region are working on similar initiatives, they are not as far along.

“No one is going at this as aggressively as Northern Virginia,” said Andy Levine, chairman of Development Counsellors International. The Fairfax County Economic Development Authority recently hired his New York-based consulting firm, which specializes in the marketing of locations, to help with the initiative.

“Many of our clients are somewhat hesitant, but Fairfax and Northern Virginia are diving into the pool headfirst,” Levine said.

The effort will take multiple forms. NOVA EDA, which includes the economic development agencies of 10 counties and municipalities, plans a campaign using social media such as Snapchat and Twitch. It will also sponsor esports competitions. And it will have a strong presence at events such as the South by Southwest festival, which attracts a young, tech-minded crowd.

“If you really want to get to millennials, you have to go to the right social media,” said Victor Hoskins, president of the Fairfax authority.

The target audience is “looking for a food culture, brew and distillery culture, bike paths, walking trails.” Hoskins said. “How can we package this so they can easily navigate it and relate it to a job opportunity, too?”

The Northern Virginia Chamber of Commerce plans to help companies develop internship programs, share best practices and encourage them to collaborate with educational institutions to yield a workforce with up-to-date skills.

“It’s really important to convince millennials that this is an exciting place to be, that it’s an innovative region and there are lots of opportunities here,” chamber president Julie Coons said.

In a related initiative, educational institutions including Virginia Tech, George Mason University and Northern Virginia Community College are expanding tech education programs and collaborations with business.

Virginia Tech just named the head of its new $1 billion Innovation Campus in Alexandria, which will train hundreds of graduate students in technology development. George Mason plans to expand its Arlington campus and triple the number of master’s degrees awarded in tech fields.

Northern Virginia Community College has a cloud specialization program, which includes an apprenticeship project with Amazon Web Services. (Amazon founder and chief executive Jeff Bezos owns The Washington Post.) Its graduates are estimated to make up between 10 percent and 15 percent of AWS’s incoming workforce in the region. The school also has a program with Micron in which students make memory chips at a Micron facility while completing their degrees.

Anne Kress, the school’s president, said such efforts are needed to position the region to compete.

“There was a time when [companies] didn’t talk about the workforce, they talked about locations: ‘What are the schools like? Is it a good place to live?’” Kress said. “Now they’re asking, ‘Where is the talent?’ ”

The area’s success in building what’s called a “tech talent pipeline” will go a long way in determining whether it fulfills its promise of becoming a world-class technology industry center.

Amazon’s decision to build its second headquarters in Arlington put a stamp of approval on Northern Virginia and the Washington region as a technology hub. But the area must still must compete with other metro regions such as New York, San Jose, Seattle and Boston for premier talent.

The talent shortage results from a combination of factors, including low unemployment and rapid advances in technology that require continual upgrades in personnel.

Terry L. Clower, director of George Mason University’s Center for Regional Analysis, told a recent economic conference hosted by the Northern Virginia Chamber of Commerce that difficulty in attracting and retaining workers was one of the principal threats to the region’s future economic growth.

Coons said finding workers was the No. 1 concern for executives she meets.

“Every single time, when I ask, ‘What is your biggest challenge?,’ it’s always workforce,” Coons said. “Even our members who are offering good jobs, good salaries, are struggling to fill those roles.”

The District and suburban Maryland are also engaged in the talent hunt, and there are signs that the region may eventually band together and compete as a group.

The D.C. Office of Planning and Economic Development will join NOVA EDA in promoting the region as a whole at South by Southwest in March. Prince George’s County is also sending representatives to the festival.

“I’m assuming that eventually D.C. and suburban Maryland will be with us in this effort,” Hoskins said.

The District is organizing its own “tech talent summit” in April.

“Our hope is that we can share best practices about hiring and retaining diverse talent,” said John Falcicchio, whom Mayor Muriel E. Bowser (D) recently nominated to be deputy mayor for planning and economic development.

The Montgomery County Economic Development Corp. has been working with Montgomery College and the Universities at Shady Grove to develop technology curriculum, especially in the health sciences.

The two biggest challenges to attracting and retaining tech-educated young people are all too familiar in the Washington region: high housing costs and lengthy commutes. So fixing the talent shortage ultimately involves addressing those difficulties as well.

“All of us know young college grads who have gone to other parts of the country because of the cost of living,” Coons said. “If you don’t solve the housing problem and transportation, you don’t fully solve workforce.”