After a goalless first period in Maryland where Fabregas squandered an early chance from the penalty spot, Villa secured a 2-0 victory for the World Cup holders with his first goal just after the hour mark, before wrapping up the win late on.
Villa headed in from close range from a Sergio Ramos knock-down just after the hour mark. And after Spain squandered several chances to put the result out of sight, Villa sealed the win with a strike from the middle of the penalty area three minutes from the end.
Striker Diego Costa, who was forced off the pitch during the Champions League final between Atletico Madrid and Spanish rivals Real Madrid with a hamstring problem, started the match up front.
It was a boost ahead of the trip to Brazil, and Costa had an immediate impact on the match when he won a penalty for his side in the third minute after being fouled by Derby Carrillo.
Fabregas stepped up and placed the ball on the penalty spot, but the Barcelona midfielder stopped his run and then blasted the spot-kick high over the bar.
Pedro then went close for Spain when Fabregas slotted the ball to the midfielder, but El Salvador goalkeeper Carrillo rushed out to make the save.
Fabregas again tested the El Salvador's defence in the ninth minute with a delicate side-footed shot which was blocked.
Costa had a relatively quiet first period while Andres Iniesta was causing problems in the middle, but the Atletico striker, expected to join Chelsea soon, got in behind the El Salvador defence just before the half-hour mark after a good long ball by Xabi Alonso.
Carrillo made the save but Costa was again on the prowl soon after as his confidence appeared to be growing as the game progressed,.
Despite all of their chances, Spain went into half-time locked at 0-0 with a team 67 places lower than Vicente Del Bosque's top-ranked side.
The Spain coach made several changes for the second half, with Fabregas replaced by David Silva while Iniesta made way for Santi Cazorla and Villa came on for Pedro.
Carrillo denied Villa and Juanfran in the second period but the former eventually made the breakthrough in the 61st minute.
Alonso fired in a deep cross and Ramos beat the El Salvador defence to knock the ball down for Villa, who headed in the opener from close range.
Costa then saw a shot denied by Carrillo and was replaced by Xavi in the 73rd minute before Silva had a shot repelled.
Sergio Busquets struck the bar from 25 yards as Spain went close again but it was Villa who made sure of the result in the 87th minute with a 12-yard strike set up by Silva.