With the round-of-32 matchup practically decided after Barcelona's 4-1 victory in the first leg, the match lacked pace at the start and Cartagena's Diego Segura almost snatched a goal for the third-division side when he curled a free kick off the upright in the 28th minute.
But three minutes later Pedro Rodriguez scored his third goal of the series before Cristian Tello's deflected shot sneaked inside the post in the 68th.
Neymar rose over his marker to head home Andres Iniesta's cross in the 88th and record his first goal in the competition. The Brazil striker scored a hat trick against Celtic last week and he netted twice against Villarreal over the weekend.
Barcelona will next face Getafe after it brushed aside second-division Girona 4-1 to go through 5-2 on aggregate. Barcelona first travels to Madrid to play Getafe on Sunday in the Spanish league before they meet twice more in the cup in January.
More From This Section
Getafe cruised to the win at home on goals by Pablo Sarabia, Adrian Colunga, Angel Lafita and Lisandro Lopez.
Alcorcon, the minnow that shocked Real Madrid 4-0 in 2009, fought back on the road to erase a 2-0 first-leg loss to Granada before bettering the topflight side on penalties.
Alcorcon showed more mettle in the shootout that went to a sixth round before Granada center back Jeison Murillo launched his spot kick over the bar.
Also, Osasuna eliminated Malaga on away goals after a 1-1 draw, earning the Pamplona-based side a possible meeting with Madrid in the round of 16.