The one-alarm fire was reported at 1:50 p.m. near a three-unit commercial building in the 4000 block of Harwood Road.
Firefighters responded in case the building caught fire.
San Jose fire spokesman Capt. Tim Miller said PG&E crews located the line on fire at about 5:10 p.m.
Miller said PG&E crews were able to turn off the gas fueling the fire at about 6:15 p.m.
The nearby building sustained some exterior damage, but the interior of the building remains undamaged, Miller said.
Utility crews had shut off power to about 3,000 customers near the fire because it was impinging on power lines, Miller said. PG&E crews were restoring power and gas to customers still without those services at about 6:30 p.m., Miller said.
No injuries were reported and no evacuation of the commercial building was necessary because the building was vacant at the time of the fire.