The sons, both 16 years old, were preparing to go to Syria through Morocco on Tuesday, the ministry said in a statement.
The teens had been in contact with jihadist recruitment networks for help in organizing their trip, which was to take them into Syria through Turkey, according to the authorities.
The ministry said the brothers had been under surveillance since a third brother had traveled to Syria, where he is believed to have "joined jihadists groups linked to Daesh (an acronym for the Islamic State group)."
That brother died in 2014.
The siblings arrested in Badalona were "planning to travel to the Iraqi-Syrian conflict zone with the full knowledge of their direct entourage, in particular their mother, whose other son had already died in the same conflict," the interior ministry said.
The two youths had reportedly left their regular education to be immersed in Koranic studies and a radical programme, according to the ministry.
Spain has been conducting raids on a series of suspected extreme Islamist cells in recent months, most of them in Ceuta and Melilla, two Spanish-governed coastal cities fenced off from northern Morocco. Tuesday's raid in Catalonia marks the fourth this year.
Last year, officials detained 47 people in 12 different anti-terrorism operations.
Most of those arrested have been accused of recruiting militants for Islamic State fighters rather than actually planning attacks themselves.
Spanish authorities say about 100 people from Spain are suspected of having joined jihadist fighters with Isis and al-Qaeda subsidiary al-Nusra Front in Iraq and Syria – still a relatively small number compared to the thousands of French, British, Belgian and German nationals who have traveled to the Middle East to join extremist groups.
Officials fear those who leave may return to launch attacks.