The Shrimps were in front at the interval through Jack Redshaw but Luke Gambin levelled matters immediately after half-time before Lopez struck three times, the second from the penalty spot after visiting 'keeper Barry Roche was given his marching orders.
Redshaw had opened the scoring in the 33rd minute, collecting a raking clearance from Roche to run clear and slide home.
Player/manager Edgar Davids and Mark Byrne both came close for the Bees in the first half but they were deservedly level soon after the break, Gambin collecting a chipped ball from Lopez before firing home.
Just after the hour mark Lopez had his first, a tap-in after Roche had failed to clear his lines, and moments later the Spaniard doubled his tally from the spot after the Morecambe 'keeper felled Gambin in the area.
And with three minutes left the Stevenage loanee completed his treble, firing home past substitute stopper Andreas Arestidou from six yards out as the home side went three points clear of the drop zone.