Fire crews were called to the Esso service station in Mountain Ash, Cynon Valley, just before 0200 BST.
The blaze was in the forecourt shop, and South Wales Fire and Rescue Service said it spread quickly to a roof space.
Crews prevented fire speading to fuel pumps and nearby houses, and brought it under control after three hours.
The fire service sent crews to the station on Cardiff Road from five locations - Aberdare, Abercynon, Merthyr, Pontypridd and Whitchurch.
They said their job was made difficult when the blaze spread to the concealed roof space.
Petrol station staff were evacuated, along with some people in nearby homes.
Power supplyA nearby road was closed due to the smoke and the attendance of the fire crews.
The fire service said the power supply to the pumps was "quickly isolated" and the blaze was restricted to the shop and office building.
The fire was brought under control at about 0500 BST, and residents were allowed to return to their homes.
The cause is not being treated as suspicious. Firefighters will return later on Sunday to inspect the scene again.
News Feed from BBC News



