It represents the most wide-ranging response yet by the top United Nations body to the jihadists, who now control large swaths of territory in both countries and have been accused of atrocities.
The British-drafted measure also placed six Islamist leaders -- from Kuwait, Saudi Arabia and other nations -- on the Al-Qaeda sanctions list, which provides for a travel ban and assets freeze.
The six include senior Al-Qaeda leaders who have provided financing to the Al-Nusra Front in Syria and Abu Mohammad al-Adnani, the spokesman for the Islamic State in Iraq and the Levant (ISIL), now renamed Islamic State (IS).
"We have watched with horror their brutal actions -- attempts to wipe out entire communities on the basis of their religion or belief, indiscriminate killing, illegal and savage executions, deliberate targeting of civilians and appalling levels of sexual violence, especially against women and children," he said.
Also Read
The resolution won the backing of all 15 members of the council, including Russia, whose backing for Syrian President Bashar al-Assad partly stems from concerns that his downfall could lead to Islamists ruling Damascus.
It "calls on all member states to take national measures to suppress the flow of foreign terrorist fighters" to the extremist groups and threatens to slap sanctions on those involved in recruitment.
It also warns governments and entities that trade with the jihadists, who now control oil fields and other potentially cash-generating infrastructure, "could constitute financial support" that may lead to sanctions.
The crisis in Iraq has prompted the United States to launch air strikes and air-drop food and water to help tens of thousands of civilians fleeing the jihadist advance in fear for their lives.