Glamorgan began the last day in a precarious position, still requiring 75 to make Hampshire bat again with only five wickets remaining - but their tail resisted for another 49 overs before they were all out for 285.
The opening batsman Alun Evans hit a career-best 87 after holding out for four hours and 35 minutes while Gary Butcher made 85 as Hampshire struggled to break through.
The West Indian all-rounder Nixon McLean soon dismissed Owen Parkin but Butcher and Evans put on 50 before Evans deflected John Stephenson down the leg side, where the wicketkeeper Adrian Aymes held the catch.
Butcher lifted Dimitri Mascarenhas for six as he helped Glamorgan into the lead. Adrian Shaw did not last long but Darren Thomas helped Butcher add another 43 runs for the ninth wicket. Then the last man, Steve Watkin, hung around while another 31 were added.
Butcher was in sight of a century when he edged Hartley to Aymes to leave Glamorgan needing a miracle. It did not arrive: Hampshire had 38 overs to score 84 and they made sure of a comfortable victory with almost 15 to spare.
Along the way Watkin removed Stephenson to a catch in the slips, but Giles White and Paul Whitaker saw Hampshire home in an unbroken stand of 41.
Adrian Rollins fell for a dogged 107, caught by Mike Smith off Jon Lewis, as Derbyshire, who followed on 169 runs behind, safely held on for a draw against Gloucestershire at Chesterfield.
Michael May gave Rollins some sound support with 54 before he was caught behind by Jack Russell off Mark Alleyne. Derbyshire declared on 300 for 5 to close the day's proceedings, with Gloucestershire not having time to begin their second innings.
The lively Lewis had earlier taken six for 48 - his best first-class figures - as the home side were skittled out for 290 in their first innings. Matthew Cassar remained unbeaten on 78 but he could not prevent Gloucestershire inviting their opponents to bat again. Cassar was again unbeaten, on 22, at the end of the day.
Yorkshire's game with Leicestershire was abandoned as a draw after no play was possible yesterday at a rain-sodden Headingley.