Opposition lawyer James Orengo told the court the law undermined civil liberties
It asked the High Court to annul the law, saying it risked turning Kenya into a dictatorship.
The court refused to immediately suspend the legislation, but asked both sides to return to court on Wednesday.
The government says its security and intelligence agencies need more powers to tackle militant Islamists threatening Kenya’s security.
In the past month, al-Shabab, a militant group linked to al-Qaeda, has killed 64 people in two attacks in Kenya’s north-eastern region of Mandera.
Last year, 67 people were killed when it laid siege to the upmarket Westgate shopping centre in the capital, Nairobi.
Kenya’s parliament passed the law during a chaotic session on Thursday, which saw brawls between opposition and governing coalition MPs.
James Orengo, a lawyer for the opposition Coalition for the Restoration of Democracy (Cord) party, told the court the legislation had more than 10 clauses which violated the basic liberties of Kenyans, and was “inconsistent” with the constitution.
The BBC’s Abdullahi Abdi in Nairobi says the case is likely to go to a full hearing after Judge Isaac Lenaola ordered both opposition and government representatives to appear before him on Wednesday.
President Uhuru Kenyatta has approved the law, but it needs to be formally published before it comes into force, he says.
Cord leader Raila Odinga said his supporters would take to the streets if the party’s legal challenge failed.
“People are afraid, very afraid of the new laws, and it is easy to understand the fear. This is how dictatorship and collapse all begin,” he said outside court.
Al-Shabab is fighting to create an Islamic state in Somalia, but it has been increasingly targeting neighbouring Kenya.
The militants are demanding the withdrawal of Kenyan troops in Somalia.
Kenya sent soldiers into Somalia in 2011 to attack militants it accused of being behind the kidnapping of foreigners on Kenyan soil.