The refinery was recently fined for safety violations amid what federal watchdogs call a troubling trend of serious accidents at refineries.
Three men died at the scene early Friday and two women died later at a Seattle hospital.
Two other men were badly burned. Matt Gumbel, 34, and Lew Janz, 41, were hospitalized in critical condition at Harborview Medical Center in Seattle.
The blast shook houses and woke people miles away at about 12:30 a.m. Friday, shooting flames as high as the refinery's tower before the blaze was extinguished about 90 minutes later.
Anacortes is about 70 miles north of Seattle on Puget Sound.
"We could tell this was horrific, this was huge," said Jan Taylor of La Conner, Wash., who felt the blast rock her motorhome at the RV park across the bay.
It was the largest fatal refinery accident since a 2005 explosion at a BP American refinery in Texas killed 15 people and injured another 170.
Six investigators with the U.S. Chemical Safety and Hazard Investigation Board were dispatched to the scene, and the Washington Department of Labor and Industries launched an investigation.
The company said employees were doing maintenance work on a unit that processes highly flammable liquid derived during the refining process.
Killed were Matthew C. Bowen, 31, of Arlington; Darrin J. Hoines, 43, of Ferndale; and Daniel J. Aldridge, 50, of Anacortes, according to the Skagit County coroner. A 29-year-old woman died of her burns at the hospital; she was identified as Kathryn Powell of Burlington.
Tesoro identified the fifth victim as 36-year-old Donna Van Dreumel, employed at the plant since 2001. The Oak Harbor woman died Friday night at Harborview.
The blast occurred in a unit that was in the dangerous process of returning to operation, turning up heat and pressure, said Tesoro spokesman Greg Wright.
"It's a volatile process," Wright said. "We are diligent about being safe."
Michael Silverstein, an assistant director at the state labor department, described the explosion and fire as occurring in a bank of boilers.
Since the boilers heat fluids to high temperatures under great pressure, they are "inherently vulnerable to events like this unless they are maintained and operated in a safe manner," Silverstein told a Friday afternoon news conference near the state capital of Olympia.
"It's going to take us quite a while to really develop the full chronology and to look at the details," Silverstein said. "We want to do everything possible to help prevent this from ever happening again."
The agency fined the San Antonio-based company $85,700 last April for 17 serious safety and health violations, defined as those with potential to cause death or serious physical injury.
Inspectors found 150 instances of deficiencies and said the company didn't ensure safe work practices and failed to update safety information when changes were made to equipment.
In November, the state reached a settlement with Tesoro, requiring in part that the company correct the hazards and hire a third-party consultant to do a safety audit. The settlement reduced the total penalty to $12,250 and lowered the number of violations to three.