The Swans took the lead in the first minute through a sublime Jamie Paterson chip, but Piroe equalised within three minutes with a calm finish.
Georginio Rutter put the hosts ahead in first-half stoppage time after his deft touch allowed him to race clear.
James then slammed home after Rutter turned provider to seal Leeds’ victory.
Leeds were good value for their 10th league win of the season as they do their best to keep up with the relentless pace being set at the top of the table by Leicester and Ipswich.
Daniel Farke selected three ex-Swansea players in his starting XI in Joe Rodon, James and Piroe, with the visiting supporters surely fearing they would be hurt by one of their high-profile exes.
Indeed, those fears looked like they might be realised straight from kick-off when James thought he had given the hosts the lead as he steered home from close range, but the offside flag denied him.
Swansea took advantage of the let-off in stunning style as they swept up the other end to score, with Paterson exquisitely chipping Illan Meslier to put the ball in the net for a second time in the opening minute.
Leeds’ disappointment at going behind inside 60 seconds lasted for only three minutes as Piroe collected from Crysencio Summerville’s smart through ball and steered the ball beyond Swansea goalkeeper Carl Rushworth to score in his first appearance against his former club.
The hosts came into this contest in their best form at Elland Road since 2019, but they found Swansea’s resistance stubborn as Josh Key went close for the visitors who themselves had won three of their previous four away games.
However, Leeds’ quality in attack meant they went into the break ahead as Rutter’s superb control allowed him to race clear and finish coolly from Ethan Ampadu’s long through ball.
Farke’s side continued to push for a third goal with Glen Kamara’s effort blocked before Summerville blasted over after Rutter found him in space.
Key’s misplaced pass out from the back presented James with a fine chance to put Leeds clear, but the Wales winger fired straight at Rushworth despite having time and space in the box.
James made amends just past the hour, finishing with power from close range to score for the fourth home league game in succession.
Leeds look formidable at Elland Road, having now won six home league games in a row and they might have added a fourth via substitute Patrick Bamford, but he fired wide and saw another effort saved by Rushworth.
Former Crystal Palace and Everton winger Yannick Bolasie made his Swansea debut as a 79th-minute substitute, but he was powerless to stop Michael Duff’s side from slipping to a defeat that leaves them 18th in the Championship.
“I thought at one moment it could be a really long day in the office, but I have to give compliments to my lads
“Although it was a difficult and complicated game in the first half, we didn’t lose our nerve.
“We were spot on, we didn’t give any chances away – they caused us some problems with their possession, we had a few problems with our pressing.
“But all in all it was a pretty mature performance and a very deserved win, there’s no doubt about this.”
“In terms of the result it was a disappointing night for us, yes.
“The performance was really good… but we conceded poor goals at poor times.
“We had a warning shot in the first minute and then conceded within a few minutes.
“If we don’t concede with the last kick of the first half it’s a different game in the second half, but we were undone by Premier League quality.”