A Japan Airlines Boeing 787 Dreamliner jet aircraft is surrounded by emergency vehicles while parked at an E gate terminal at Logan International Airport in Boston, Monday.

BOSTON — An electrical fire filled the cabin of a Japan Airlines Boeing 787 with smoke Monday minutes after passengers disembarked following a non-stop flight from Tokyo.

The Massachusetts Port Authority’s fire chief, Bob Donahue, said the fire at Boston’s Logan Airport began in a battery pack for the plane’s auxiliary power unit, which runs the jet’s electrical systems when it’s not getting power from its engines.

Fire crews using infrared equipment found flames in a small compartment in the plane’s belly and had the fire out in about 20 minutes, he said. There was a flare-up later when a battery exploded, he added.

The flight landed normally at about 10:15 a.m. Its 173 passengers and 11 crew members had already gotten off the jet when a mechanic spotted light smoke in the cockpit and cabin about 15 minutes later and notified Massport.

“When we arrived, it was a heavy smoke, and that was in three minutes, so this was advancing,” Donahue said.

The mechanic was the only person on board when the fire broke out. One firefighter had skin irritation after contact with the chemical used to douse the fire, Donahue said.

The 787 is Boeing’s newest plane, and the first was delivered in late 2011. In November 2010, a test flight had to make an emergency landing after an in-flight electrical fire. The fire delayed flight tests for several weeks while Boeing investigated.

Last month, a United Airlines 787 flying from Houston to Newark, N.J., diverted to New Orleans because of an electrical problem with a power distribution panel. No one was injured.

The 787 uses two lithium ion batteries — including one for the auxiliary power unit, according to a Boeing guide for firefighters dealing with the 787.

The rechargeable batteries, widely used in consumer devices, have some pilots worried because batteries being shipped as cargo are suspected to have caused or contributed to the severity of fires in cargo planes.

When Boeing proposed using the batteries in the 787, the Federal Aviation Administration issued special rules, including a requirement that they be designed to prevent overheating.

The FAA noted in its 2007 rule that, “In general, lithium ion batteries are significantly more susceptible to internal failures that can result in self-sustaining increases in temperature and pressure. ... The metallic lithium can ignite, resulting in a self-sustaining fire or explosion.”

The severity of overheating is higher in larger batteries, the FAA said in the rule.

The National Transportation Safety Board said it’s sending an investigator to Boston. The Federal Aviation Administration also said it was investigating.

Boeing Co. spokeswoman Lori Gunter said the company was aware of the fire and was working with JAL. She said she couldn’t immediately answer other questions because Boeing’s technical team was focused on the investigation.

Boeing has delivered 49 787s, including seven to Japan Airlines. Another 799 have been ordered by airlines worldwide.

Ed Freni, Massport’s aviation director, said JAL officials reported that the plane that caught fire Monday was delivered to the airline in late December.

JAL began nonstop service between Boston and Tokyo’s Narita Airport using the Boeing 787 in April. A return flight to Tokyo was cancelled Monday and JAL was working to reschedule passengers, a JAL spokeswoman said.