John Terry’s early own goal had gifted Swansea the lead before Costa’s treble took his tally to seven goals in four games and debutant Loic Remy also weighed in with a goal.
Swansea were the better team in the first half and edged in front on 11 minutes when Neil Taylor’s teasing low cross was turned into his own net by Chelsea captain Terry.
Chelsea equalised in the final minute of the half when Cesc Fabregas’ corner was powerfully headed home by Costa, who became the first player since Mick Quinn in 1992 to score in his first four Premier League appearances.
The same two players combined to put Chelsea in front on 56 minutes as Fabregas exchanged passes with Eden Hazard before pulling the ball back for Costa to score from close range.
Costa’s opportunism brought the Spain international’s hat-trick on 67 minutes as he reacted the quickest to Ramires’ weak shot to stab the ball past Lukasz Fabianski.
Remy replaced Costa and the substitute marked his debut with the fourth goal on 81 minutes with a low finish after the striker was teed up by Oscar.
Jonjo Shelvey pulled one back for Swansea with four minutes to go, but the result ensures Chelsea are the only team with a 100 per cent record after four games.
Jose Mourinho might have been tempted to keep Costa in reserve for games against Schalke and Manchester City next week after a hamstring injury saw him withdraw from international duty with Spain.
But it soon became apparent that the Blues would need him after Swansea started well.
Wayne Routledge volleyed wide and then dispossessed Nemanja Matic in a challenge he should not have won in the move which led to the opening goal.
Ki Sung-yeung, influential early on, fed left-back Taylor, whose cross Terry could only turn in to his own net.
Bafetimbi Gomis – Swansea’s one change following the 3-0 defeat of West Brom, Wilfried Bony dropping to the bench – twice had half chances but could not find the target.
Routledge curled one narrowly wide as Swansea threatened again before Chelsea finally came into the game.
Jordi Amat and Shelvey were each booked for fouls on Hazard on the edge of the Swansea box and from the second opportunity Andre Schurrle’s free-kick was tipped over by Fabianski.
A Branislav Ivanovic cross evaded Costa and was headed over by Oscar, who then tested Fabianski with a low shot before his dangerous cross from the right was dealt with by the Polish goalkeeper.
Costa and Amat tangled on the touchline as the striker showed his menace before delivering another blow.
The £32million summer signing – a man Mourinho chased for a year – lurked behind Ivanovic before meeting a Fabregas corner with a low, firm header.
Mourinho was clearly not satisfied with seeing his team reach the interval level as World Cup winner Schurrle was replaced by Ramires.
Amat, treading a fine line against Costa, went off for Federico Fernandez for Swansea.
Costa immediately tested Swansea’s defence, his effort from a corner ballooning over off Ivanovic.
Soon Chelsea – and Costa – had a second after a one-two between Fabregas and Hazard on the left edge of the Swansea box.
In a combination that is becoming familiar even at this early stage in the season, Fabregas laid on the assist, pulling the ball back for Costa to finish clinically.
Shelvey sliced wide and Gomis was unable to lift the ball over the onrushing Thibaut Courtois, who had a quiet second half as he celebrated his new five-year contract.
Courtois watched from afar as Costa struck once more when Ramires scuffed his shot into the path of the striker, who pounced to complete his hat-trick.
Chelsea owner Roman Abramovich smiled widely and joined in the applause as Costa departed after 72 minutes for Remy to make his debut.
Remy, signed only after Fernando Torres’ loan move to AC Milan, quickly made his mark, tucking in Oscar’s pass.
Shelvey pulled a goal back with four minutes to play after substitute Bony’s incisive pass.
Mourinho tucked the ball under his arm after it entered his technical area from the restart and Swansea could not breach the Chelsea defence again.