McCarthy, a summer signing from National League Weymouth, bagged his first goals for the club with two strikes in the space of 16 first half minutes.
The 25-year-old then teed up two-goal striker Alex Wall for his second in Hawks' victory.
Hawks’ other goal came from James Roberts a minute from time while things were made a little more tense than they should have in the closing stages with Joe Newton’s own-goal and Tyrone Lewthwaite heading home.
But National League South Hawks saw it through and can now look forward to Monday’s third round qualifying draw.
Predicted Portsmouth XI v Cheltenham: changes expected to side that beat Cardiff so handsomely - but attacking duo could keep places and defender set to return
Portsmouth transfer news: Blues youngsters attracting interest but Danny Cowley has no desire to cash in just yet
Portsmouth boss Danny Cowley makes transfer admission as former Luton and Millwall midfielder edges closer to Fratton Park exit
Former Portsmouth keeper Alex Bass suffers tough night on and off the pitch as he makes Sunderland debut following Fratton Park exit
League One latest: Oxford land former Pompey striker target from Swansea as Sheffield Wednesday bemoan exciting duo's move to Brentford and former Peterborough boss criticises club
Hawks made four changes from the side who were beaten at home by Oxford City last time out. Alex Wall, Billy Clifford, Oscar Gobern and Abdulai Baggie all came in for Paul Rooney, Manny Adebowale, Tommy Wright and Scott Rendell.
Hawks made a bright start but were nearly caught out after 16 minutes. Oscar Gobern was dispossessed by Aaron Minhas who then found Tyrone Lewthwaite. He was then taken taken the ground by Joe Oastler but, with Beaconsfield calling for the defender to be dismissed, referee Michael Ryan brandished a yellow card.
Having survived that scare, it was Hawks who took the lead on 24 minutes. Full-back Josh Passley drove forward down the right, picked out an unmarked McCarthy in the area, who cooly slotted past Alex Tokarcyzk.
The tie really came to life in an eventful end to the first half. First, McCarthy grabbed his second with another tidy finish after 40 minutes following good work from James Roberts to take the ball off Oliver Sprague then finding his team-mate.
Back came Beaconsfield, though, and Aaron Minhas got his side back to within a goal of Hawks with his deflected strike beating Ross Worner just two minutes later.
Striker Wall would restore Hawks' two-goal cushion before the break. Joe Newton's clever dinked pass put the towering forward through and he curled a shot into the top corner.
Midfielder McCarthy should have completed his hat-trick after a quiet start to the second half. Billy Clifford's pinpoint cross picked him out, although he could only glance his header wide on 59 minutes.
Hawks' fourth did arrive three minutes later, McCarthy this time turned provider, with his cross finding Wall to tuck home his second from close range.
Beaconsfield were handed a lifeline as Newton's bizarre own-goal six minutes from time with passing a cross back into his own net.
Hawks added a fifth through James Roberts a minute from time while Lewthwaite headed home 60 seconds later in what proved a lively end to the tie.
Hawks: Worner; Passley, Magri, Oastler, Newton, Gobern, Roberts, Clifford, McCarthy, Baggie, Wall. Subs: Wright (Wall, 66), Adebowale (Oastler, 70), Rendell (Gobern, 75), Searle, Rooney.