SAN FRANCISCO — Tech titans spent much of the last year playing defense, fending off dozens of federal and state antitrust investigations and a public wary of their power.

But the global coronavirus pandemic is prompting a dramatic reversal of fortune for the tech giants. Amazon and Facebook are capitalizing on the fact that they are viewed as essential services for a public in lockdown, while Google and Apple are building tools that will enable state health departments to provide a critical public service, tracing the course of potential new covid-19 infections.

The pace of the probes against these companies has slowed as regulators and lawyers are forced to work from home. Emboldened tech lobbyists are fighting to delay the enforcement of a new privacy law this summer in California, saying they can’t comply by the July deadline due to the upheaval.

And while the global economy faces potential unemployment and contraction not seen since the Great Depression, the tech giants — and a handful of medium-size ones — are already benefiting from new consumer habits initiated during the lockdowns that analysts believe will turn into longer-term shifts in how people shop, work and entertain themselves. The broader stock markets tanked in recent weeks, but share prices of Amazon and Microsoft hit at or near records. Facebook is moving to acquire high-skilled talent, announcing the hiring of 10,000 new workers this year.

The tech giants‘ deep pockets will enable them to withstand the coming global economic recession, a stark contrast to what industry insiders and analysts expect to be the biggest shake-up of the tech landscape in years. As many start-ups collapse, tech giants will expand on the power they’ve accumulated using the playbook of the last decade: snapping up talent, buying or copying rivals, and eroding traditional industries. Some of those weakened companies may disappear altogether and cede even more territory to tech.

Former Google CEO Eric Schmidt said at a recent virtual panel that the most powerful companies have the ability to bounce back far more quickly than others. “When you have an industry leader, and something collapses, the industry leader, if it’s well-managed, tends to emerge stronger a year later,” he said.

Facebook and Google declined to comment. Apple did not respond to requests for comment. Amazon spokesman Dan Perlet said in a statement, “While we appreciate the opportunity as a retailer to serve customers and are seeing increased demand for essential products, there are no winners out of Covid-19.”

(Amazon founder and chief executive Jeff Bezos owns The Washington Post.)

As the tech giants start announcing quarterly earnings this week, Big Tech‘s current position is far better than in previous market crashes. In the dot-com bust of 2001, Google was not yet public. Amazon almost went bankrupt, losing 90 percent of its value in two years. The crash was seen as a crisis of Silicon Valley’s own making, as money flooded into thousands of frothy, pie-in-the-sky start-ups with unsound business models.

During the Great Recession in 2008 and 2009, large technology companies were hit along with the global economy. Facebook was still privately held. The combined value of the five richest companies — ExxonMobil, General Electric, Microsoft, AT&T and Procter & Gamble — was $1.6 trillion. Today, tech giants occupy those top spots. Microsoft, currently the most valuable company in the world, is worth $1.3 trillion alone.

“There are really two Americas right now,” said Scott Galloway, a marketing professor at the New York University Stern School of Business and author of “The Four: The Hidden DNA of Amazon, Apple, Facebook, and Google.” “There is Big Tech and there is everyone else. They can do what very few companies can do, which is play offense in the middle of a pandemic.”

Meanwhile, over 250 start-ups have already shed more than 30,000 jobs since March 11, according to Layoffs.fyi, which tracks Silicon Valley layoffs and furloughs. A recent survey of 400 investors and founders by the venture capital firm NFX found that more than half of start-ups said they had initiated a hiring freeze or had lowered their value in the hopes of attracting new investment. Start-ups that have raised hundreds of millions of dollars, such as the scooter company Bird, have laid off large portions of their workforce. The company made the tough decision to lay people off — over a minutes-long Zoom call — to keep the company afloat through 2021, according to a company memo reviewed by The Post.

“Every start-up and every investor is having these conversations right now,” said investor Roy Bahat, head of Bloomberg Beta, a venture fund backed by Bloomberg LP. “We’re telling the start-ups we invest in that the safest assumption is that the next time you can raise money again is never.”

Review service Yelp, however, could face an even bigger blow. Yelp for years has complained that Google has copied its services and used its power to redirect people away from the company’s listings in search results. Now the company is laying off or furloughing more than 2,000 people — over a third of its workforce. Unlike Google, which has diversified ad revenue and huge cash reserves, Yelp generates almost all its revenue from advertising by local brick-and-mortar businesses, like salons and gyms. Interest in those business categories alone has fallen more than 73 percent, chief executive Jeremy Stoppelman said in a blog post.

Yelp declined to comment.

Inside Google, a cautious attitude prevails as the search company anticipates significant losses in income from advertising in the coming months, particularly from the travel, entertainment and retail industries, according to people who work there, who, like others, spoke on the condition of anonymity to talk freely without having to get company authorization. Estimates by eMarketer predict overall spending on search and display advertising, which constitute Google’s core businesses, could drop by at least 20 percent or be as high as 38 percent in the quarter starting April 1.

“The entire global economy is hurting, and Google and Alphabet are not immune to the effects of this global pandemic,” Sundar Pichai, chief executive of Alphabet, Google’s parent company, wrote in an email to staff this month. “We exist in an ecosystem of partnerships and interconnected businesses, many of whom are feeling significant pain.”

But he tempered the warnings, promising no major layoffs. The company would “be slowing down the pace of hiring, while maintaining momentum in a few strategic areas,” Pichai said.

Google, however, may benefit in a key way from the crisis, as tech giants’ relationship with the federal government transforms. Over the last year, the Justice Department and the Federal Trade Commission have launched probes into Apple, Amazon, Facebook and Google for potential antitrust violations, and more than 40 state attorneys general have announced wide-ranging inquiries into the business practices of Google and Facebook. Last year, the FTC levied the largest fine in the agency’s history against Facebook for violating user privacy during the Cambridge Analytica scandal, in which the company enabled the Trump-affiliated political consultancy to breach personal data from tens of millions of Americans.

Inquiries are slowed in the short term as everyone works from home, said Gary Reback, a Silicon Valley antitrust lawyer whose clients are involved in several of the federal probes.

“How much can you compel a company to do something when they are in lockdown? So if they want an extension or want a delay, what are you going to say?” he asked. “This situation plays best for the companies that have been under investigation.”

At the same time, the public is becoming more reliant on tech giants’ services, while governments outsource critical work to them. California Gov. Gavin Newsom (D) uses models and slides derived from location data from Google and Facebook to show possibilities for the path of new infections. Health departments around the country are working with Google and Apple to conduct contact tracing.

The Association of National Advertisers, a lobbying group representing Google and Facebook, is actively pushing the attorney general of California to delay the final regulations and enforcement of the state’s landmark Consumer Privacy Act, set to go into effect this summer. In several letters, the group has argued that the regulations, which require companies to provide data that they hold about consumers and allow for consumers to request deletions of data, are too onerous to comply with now that company lawyers are working from home.

As the economic contraction continues and start-ups die off, the largest firms may also be some of the only companies in the position to do any hiring. In a recent interview, Sheryl Sandberg, chief operating officer of Facebook, made a point of highlighting that the company would create 10,000 new positions this year in engineering and product roles.

That contrasts with invitations and ticketing company Eventbrite, which had to lay off or furlough nearly half its staff. While invites to virtual events are booming, the company is suffering due to the cancellation of many events and the resulting loss of its cut of ticket sales.

Eventbrite Chief Executive Julia Hartz said the choice to lay people off was “heartbreaking,” but necessary. “We knew early on that we needed to take bold action in order to survive this time,” she said. She sees the surge in virtual events as a potential business opportunity.

Eventbrite has referred some laid off employees to Facebook, she added.

Meanwhile, Facebook’s rival event team responded to the pandemic by moving their people onto other product teams that have exploded in popularity, such as Messenger and Livestream, according to the people familiar with the company’s operations. On Friday, Facebook launched a competitor to video conference services Zoom and Houseparty, allowing up to 50 people to video conference at a time.

After years of reputation problems due to Cambridge Analytica and other scandals, some employees say they are feeling a boost in morale, according to other people who work at the company, who asked to remain anonymous because they were not authorized to speak to the media. Even the newfound positive reception for the Facebook Portal — a much-ridiculed video chat device that all employees received for free to work from home — is a surprise.

Facebook chief executive Mark Zuckerberg is on the media circuit, touting the company’s efforts to keep the public safe. He wrote an op-ed in The Washington Post about how data is key to survival, and sees the crisis as a potential moment of redemption for Facebook, according to people familiar with his thinking.

Amazon executives have also launched a media blitz, touting the company’s role in supplying important goods to consumers.

Amazon is leading the biggest hiring spree of the tech giants, announcing more than 175,000 new, mostly low-wage jobs in warehouses and delivery. The company is openly recruiting workers who have been laid off from other industries, as it has struggled to keep up with the surge in consumer demand.

Meanwhile, some of its warehouse workers have protested over unsafe working conditions, as dozens of warehouses have workers that tested positive for covid-19.

“We’re investing heavily to keep our employees safe and to temporarily increase pay for associates — spending $500 million on pay increases alone through the end of April,” Amazon‘s Perlet added in the statement.

Meanwhile, Bloomberg reported that Apple chief executive Tim Cook recently told employees that the company felt so comfortable in its cash position that it would continue investing in R&D throughout this year and did not anticipate layoffs.

Big Tech’s ability to continue hiring and sustaining themselves through crises will not only give the companies an advantage in Silicon Valley, but in the economy at large. Many of the traditional industries expected to suffer — brick-and-mortar retail, food service, and media and entertainment — are the same industries that have been gradually gutted by technology since the last recession.

Macy’s, which competes with Amazon, said it was furloughing most of its 125,000 employees last month. Condé Nast Publications, which competes for ad dollars with Facebook and Google, is planning major layoffs.

While analysts expect hits in revenue to both Google and Facebook for the first time, smaller ad platforms, publishers and social media rivals will fare even worse, analysts say. Smaller digital advertising firms, long struggling against the giants, have begun to announce waves of layoffs.

And when the spending comes back, it will favor the biggest tech platforms over smaller digital ad companies and publishers, said Nicole Perrin, an analyst with eMarketer.

“A lot of the traditional media and ad businesses have been in decline. The decline will happen faster this year, and a lot of that money will not come back, because it was slowly trickling away,” Perrin said.

Still, some start-ups will thrive during the crisis. The user base of video conferencing service Zoom grew to 200 million users last month, up from 10 million in December, according to the company. Growing even faster than Zoom is video-chat app Houseparty, which has seen a 1,580 percent growth in downloads since March 15, according to app analytics firm AppAnnie. Grocery delivery app Instacart has experienced a 540 percent increase in downloads.

Analysts and investors expect that consumption patterns and habits will continue to change, potentially for the long term. That could also result in a new order among the start-ups that emerge or survive the crisis, said Roelof Botha, a partner at the Silicon Valley venture capital firm Sequoia Capital. He said he was already beginning to look for a new class of winners, automating everything from mortgages to garbage picking to data infrastructure needed to support remote work.

“This is a shock to the system, and sometimes out of that shock emerges a new order,” Botha said. “Like the killing off of the dinosaurs, this reorders who gets to survive in the new era. It is the shock that accelerates the future that Silicon Valley has been building.”

Faiz Siddiqui and Jay Greene contributed to this report.