The men were arrested last week for their alleged involvement in the planning or execution of attacks in Barcelona on Thursday and the north-eastern resort town of Cambrils early on Friday.
They were appearing before National Court Judge Fernando Andreu in Madrid, who will decide whether they should be kept in custody or released, with or without conditions.
Spanish media have named the suspects as Driss Oukabir, Mohammed Aalla, Salh el Karib and Mohamed Houli Chemal but their identities have not yet been confirmed by police.
The four were arrested following the attacks - three in the northern Catalan town of Ripoll and another in Alcanar, south of Barcelona, where a house that was destroyed in an accidental explosion turned out to be a botched bomb-making workshop.
The lone fugitive from the cell was shot dead on Monday after he flashed what turned out to be a fake suicide belt at two troopers who confronted him in a vineyard not far from the city he terrorised.
Police said they had “scientific evidence” that the fugitive, Younes Abouyaaqoub, 22, was driving the van that barrelled through Barcelona’s crowded Las Ramblas promenade, killing 13 people on Thursday, then hijacked a car and fatally stabbed its driver while making his getaway.
Abouyaaqoub’s brother and friends made up the rest of the 12-man extremist cell, along with an imam who was one of two people killed in the Alcanar house.
Police said that with Abouyaaqoub’s death, the group responsible for last week’s fatal van attacks has now been broken.
Five of the 12 suspects were shot dead by police in the seaside town of Cambrils, where a second van attack left one pedestrian dead hours after the Barcelona van attack.
The Islamic State group has claimed responsibility for both the Cambrils and Barcelona attacks.
Meanwhile, French Interior Minister Gerard Collomb has confirmed reports that an Audi used by the attackers in the Spanish town of Cambrils had been photographed speeding in the Paris region some time before last week’s attacks.
Mr Collomb said in an interview on BFM-TV on Tuesday that the black Audi A3 was caught by radar, but did not give a timeframe or location or clarify whether it was transiting through the area.
He said “this group came to Paris but it was a quick arrival and departure”.
The French daily Le Parisien reported on Monday that the car came through the Paris region about a week before Thursday and Friday’s attacks in Barcelona and Cambrils. Other papers said it was seen in the Essonne region south of the capital as well.
Mr Collomb said French and Spanish services were co-operating closely over the attacks, but the French “didn’t know the cell, which was exclusively Spanish”. His Spanish counterpart is to pay a visit to Paris on Wednesday.