JetBlue flight 915 landed safely in Grand Rapids around 8 p.m., and officials say there were no injuries, aircraft damage or delays.
The laptop was in a backpack in the cabin of the plane. At some point during the flight, passengers said they smelled smoke, and then the fire was discovered.
A woman on the plane spoke with the ABC affiliate in Michigan.
"I was stunned," Kat Honniball said. "I knew something was going to happen because, you know, lithium batteries catching on fire when you're up at 38,000 feet -- you can't help but think you gotta do something. So I was prepared for it."
The fire was put out before the plane landed.
JetBlue released a statement saying: "JetBlue 915 from New York's JFK to San Francisco diverted to Grand Rapids, Michigan following reports of smoke emitting from a carry-on bag holding an electronic device. The flight landed safely and the aircraft is being inspected by maintenance crews before customers continue on to San Francisco."
Honniball's daughter Kailey was also on the plane. She said in an email that they were stuck in Michigan for almost three hours and that people were patient at first but quickly became frustrated.
JetBlue Flt#915 f/JFK-SFO landed w/o incident here shortly after 8pm after reports of a lithium fire onboard. Airport FD responded (cont)— FlyGRFord (@FlyGRFord) May 31, 2017
Our Fire Department cleared the scene, no injuries and all clear for JetBlue Flt#915. Plane is fueled up, & will be back en route to SFO— FlyGRFord (@FlyGRFord) May 31, 2017