Wrexham had picked up four points from their two most recent fixtures against Bristol City and Ipswich Town, the latter of which was a barnstorming 5-3 victory, and knew another win on Tuesday night would help them retain their place in the play-offs.
Phil Parkinson's side made a great start in the first half, with a pair of headers giving them the lead at the break. Smith rose highest to nod in Callum Doyle's delivery before Cleworth met George Dobson's header and made it 2-0.
All seemed to be going swimmingly enough for the Red Dragons, but Portsmouth found a route back into a game with a nicely crafted goal, with Swanson dribbling from deep and playing a one-two with Regan Poole before a deflected effort looped over Arthur Okonkwo and in.
Pompey dominated the majority of the second half but just struggled to create the opportunity they needed to level the scores. The visitors racked up a huge amount of corners but just couldn't make the dead-ball situations count. Instead it was Wrexham who threatened to finish the match off as a contest when Ollie Rathbone surged forward, but the 29-year-old smashed the post when he looked set to score.
In the end it didn't prove costly for Wrexham, who secured another win to improve their chances of finishing in the play-offs at the end of the season.