Virtually all of the 1,800 Pepco customers in Northeast Washington who were without power for three days finally had air-conditioning, electricity and modern life back about 2 p.m.

Only two commercial customers remained without power, a Pepco spokesman said, and power was expected to be restored to them by Thursday afternoon.

The power outage had stopped school, government, business and many aspects of normal residential life in a swath of Northeast Washington just off North Capitol Street. Power was briefly restored Wednesday night, but underground cables failed and the power went out again.

A cooling center was set up at Walker Jones Education Campus at 1125 New Jersey Ave. NE so residents could get out of the heat.

School was canceled for the second straight day at J.O. Wilson Elementary, and the Community College of the District of Columbia was closed. The Federal Energy Regulatory Commission and Federal Maritime Commission also announced that their headquarters buildings will be closed. The federal Equal Employment Opportunity Commission is shuttered.

District officials announced that a number of city agencies also are affected by the outages. Some employees will be off, others will work from home or a remote location. Officials are notifying workers of their status.

The affected agencies include:

• Department of Public Schools, 1300 First St. NE

• Office of the Superintendent of Education, 899 North Capitol St. NE

• Department of Health Care Finance, 899 North Capitol St. NE

• Department of Health, 899 North Capitol Street NE and 1300 First St. NE

• Department of Insurance, Securities and Banking, 810 First St. NE

• Department of Human Services, 33 N St. NE

• Mental Health Clinic, 35 K St. NE

• D.C. Housing Authority, 1133 North Capitol St. NE

• Department of the Environment, 1200 First St. NE

Though the health department is significantly affected, several services have not been interrupted, officials said in a statement.

“DOH staff has been able to provide services through its Immunization, STD and TB clinics, along with the Pharmacy Warehouse, its Assessment and Referral Center and Health Emergency Preparedness and Response Administration (HEPRA),” according to a news release.

On Wednesday, a day of record heat, the power outages tormented apartment building residents and forced government officials to tell many employees to stay home.

Washington’s temperature reached 98 degrees, breaking an 1895 record for June 1. Baltimore’s 98 also broke a 116-year-old record. At Dulles International Airport, the 95-degree high also set a record.

Thunderstorms swept through the sweltering area Wednesday evening, bringing hailstones, bursts of rain and lower temperatures. Thursday’s highs are expected to be in the mid-80s, the National Weather Service said.

But on Wednesday, workers at 16 D.C. government agencies in five broiling buildings were told to report to alternative locations, work at home or take the day off as power stayed out along North Capitol Street and in nearby Northeast Washington, city officials said.

Officials said the outages, which began Tuesday, were caused by heat-related underground cable failures. Pepco said initial repairs were made Tuesday night, and work continued Wednesday.

Meanwhile, heat and outages created unhealthy conditions Wednesday at the city’s health department. The lack of electricity closed the offices of an agency that regulates electricity, the Federal Energy Regulatory Commission.

City agencies activated rarely used contingency plans. Among the departments with the most workers affected were the D.C. Public Schools’ central office (1,000 employees), the office of the chief financial officer (700) and the Health Department (300), said Millicent West, director of the District’s Homeland Security and Emergency Management Agency.

She said all D.C. agencies — especially those offering critical services — had contingency plans and nobody’s care was “compromised because of a relocation of employees.”

Mayor Vincent C. Gray (D) said that he had been helping residents of the affected area with power-related problems until 1 a.m. Wednesday. The city and the American Red Cross provided breakfast, water and snacks to residents.

Twenty-six people spent Tuesday night at the Walker Jones Education Campus, which was opened as an emergency cooling facility, West said. Four Metro ­buses also were used as cooling centers.

West said that health and emergency medical services workers were among those who canvassed apartment complexes to ensure that senior citizens were continuing to receive services.

Prince George’s County opened six cooling centers Wednesday.

Le-Ha Anderson, a spokesman for Dominion Virginia power, said that about 200 customers were without power Thursday afternoon in Northern Virginia, but the outages were not heat- or weather-related.

In 1895, the year the previous high-temperature record for June 1 was set, effects were also notable. The Washington Post reported that “there was one fatal case of sunstroke, and a number of prostrations.”

Horses “were dropping everywhere,” The Post said.

Staff writers Annie Gowen, Patricia Sullivan and Martin Weil contributed to this report.