SAN JUAN, P.R. — Hurricane Irma, one of the most powerful Atlantic storms ever recorded, battered the islands of the northeast Caribbean early Wednesday, leaving severe damage in its wake as it barreled toward the Virgin Islands and Puerto Rico.

Irma, a Category 5 storm packing winds of up to 185 miles an hour, first made landfall at 2 a.m. on Barbuda, and later in the morning passed directly over St. Martin, the National Hurricane Center reported. There were reports of flooding, major damage to buildings, and severed electricity and phone service on those islands and Saint Barthélemy and Anguilla.

The four “most durable” buildings on St. Martin were destroyed, the French interior minister, Gérard Collomb, said at a cabinet meeting in Paris, “which means that in all likelihood the more rustic buildings are probably totally or partially destroyed.”

At 11 a.m., the eye of the storm was 65 miles east-southeast of St. Thomas in the Virgin Islands, the Hurricane Center said. The hurricane was projected to make a direct hit on that island chain on Wednesday afternoon, before skirting the northeast corner of Puerto Rico.

Devastating storm surges were expected to put parts of Turks and Caicos and the southern islands of the Bahamas 15 to 20 feet underwater on Thursday.

The storm is one of the strongest ever recorded in the Atlantic Ocean, according to the center and to Bryan Norcross, a hurricane specialist at the Weather Channel. There have been, however, storms with comparable winds in the Caribbean or the Gulf of Mexico, where warm waters can fuel particularly dangerous hurricanes.

Late Tuesday, wind gusts of around 50 miles an hour arrived in Antigua and Barbuda but picked up significant strength as the center of the storm swirled several dozen miles offshore. The authorities cut off power on those islands before midnight, forcing many residents to listen to the latest forecasts on transistor radios in the darkness.

Residents throughout the Caribbean scrambled on Tuesday to rush out of possible flood zones, stock up on water, food and gas, shutter their homes and brace for what is now, and could remain, a Category 5 hurricane. On Antigua, many residents were spending the night in nearly 40 shelters because of concerns that their homes, even when boarded up, would topple in the destructive winds.

“We have to prepare for an event that we have never experienced here,” Gov. Ricardo Rosselló of Puerto Rico said earlier on Tuesday, calling the hurricane’s arrival imminent and its potential catastrophic.

Irma threatens havoc and widespread destruction across Puerto Rico, a United States territory of 3.4 million people, the island of Hispaniola (home to the Dominican Republic and Haiti), Antigua, St. Kitts and Nevis, and the United States Virgin Islands, among others. Cuba is also threatened.

President Trump declared a state of emergency in Puerto Rico, Florida and the United States Virgin Islands on Tuesday.

With Harvey’s destruction still fresh on people’s minds, Florida hustled into action. Gov. Rick Scott activated the state National Guard to help with hurricane preparations, and he suspended highway tolls. On Monday, the governor declared a state of emergency and spoke with Mr. Trump, who offered “the full resources of the federal government,” Mr. Scott wrote on Twitter.

Most of the latest projections have Irma making landfall in Florida by Sunday, although it is unclear where exactly that might happen.

The Florida Keys, an especially vulnerable chain of islands, moved quickly to prepare for crushing winds and possible flooding. On Wednesday, schools will be closed and mandatory evacuations will begin, county officials said. The Keys’ three hospitals started evacuating patients on Tuesday.

Miami-Dade, the state’s largest county, announced that schools would close on Thursday and officials began putting emergency plans into place.

But Puerto Rico and the northern Leeward Islands are expected to be hit before that. It has been nearly a century since Puerto Rico was hit by a Category 5 storm, Mr. Norcross of the Weather Channel said.

Puerto Rican officials have warned that the island’s fragile electrical grid could be shut down for days, weeks or even months in some areas. In his news conference, Mr. Rosselló and emergency officials warned that with such powerful winds expected to thrash the island, infrastructure, houses and the phone system would inevitably be damaged.

For Puerto Rico, the hurricane could not have come at a worse time. The island is in the throes of an economic crisis and does not have money for a long rebuilding process.

“This is not going to be easy,” said Héctor Pesquera, the superintendent of public security in Puerto Rico.

Abner Gómez Cortés, the head of Puerto Rico’s emergency agency, warned that coastal zones were particular vulnerable — not so much because of rain, as with Harvey — but because of storm surges of up to 20 feet.

On Tuesday, the lines for fast-dwindling gas, food, water and hardware seemed interminable and anxiety mounted. One hardware store in San Juan had been nearly picked clean by afternoon.

“This has been like this for the last three days,” said Juan Carlos Ramirez, the store manager. “We’ve sold all of the most necessary items — flashlight, batteries, plywood.”

People standing in line said one of their biggest worries was the expected loss of electricity for long periods. “The infrastructure can’t cope with a hurricane,” Ashley Albelo, a shopper, said.

Outside a Sears, Maria Ruiz could not help but remember Hurricanes Hugo and George, which badly damaged Puerto Rico. “Destruction,” she said. “That is what we can expect based on past experiences, and it’s already a Category 5.’’

Similar fears were apparent on nearby islands. In Antigua, southeast of Puerto Rico, many businesses were closed. Supermarkets were overrun and gas stations were packed.

Some island residents sounded stoic and battle-tested. In Guadeloupe, Coralice Line, who was attending the front desk at the Le Creole Beach Hotel & Spa, said she was not particularly distressed. “We are not too worried because we are accustomed to it,” she said by phone from the hotel. “Hurricanes are part of life in the Caribbean islands.”

At the Sugar Bay Club hotel in St. Kitts and Nevis, Ophelia Gardiner, the front-desk supervisor, said that while some guests had fled the island on an American Airlines flight, others had decided to stay and ride out the storm.

“Everything is boarded up and put away and all we have to do is wait and see what happens,” Ms. Gardiner said. She laughed nervously. “I don’t know how you can prepare for a hurricane of that magnitude but we’re doing our best.”

In Miami-Dade County, which is still haunted by the ferocity and wreckage of Hurricane Andrew, a Category 5 storm, residents worried and began to prepare earlier than usual. For some, a sense of panic began to set in. Many hotels across Florida had already been booked for the weekend by hurricane-wary residents. Most stores had run out of water, flashlights and other key supplies. Gas stations ran out of fuel.

Hurricane Harvey in Texas also weighed heavily on people’s minds.

“I think because of Texas, people are freaking out,” said Yoseyn Ramos, 24, a Miami resident who said she was worried because she could not find gas anywhere.

In Brickell, a Miami neighborhood that abuts both the Atlantic and the Miami River, Lucas Mattout, 22, was dashing around Publix supermarket looking for water. “They are all sold out,” he said. “Of course, with Harvey, no one wants to take a chance.”

Every storm, though, has its rebels. Jose Fonseca, 52, a Coral Gables resident who works at the Mandarin Oriental on Brickell Key, said he had not done or bought anything to prepare for the storm.

“I think people are panicking because of the news from Texas day after day,” he said. “I will buy some water.” Then, he added, “And some beer of course.”

Correction: September 6, 2017

Because of an editing error, an earlier version of this article misidentified the island where Hurricane Irma made landfall. It was Barbuda, not Bermuda.

Ivelisse Rivera reported from San Juan, and Lizette Alvarez from Miami. Reporting was contributed by Marc Santora and Frances Robles from Miami, Kirk Semple and Paulina Villegas from Mexico City, Carl Joseph from Antigua, and Niraj Chokshi and Matthew Haag from New York.