Authorities said the suspects planned to open fire in the newsroom of a paper that printed cartoons depicting the Prophet Muhammad.
Meantime, Swedish police said they've taken a fifth suspect into custody.
Officials said the arrests followed months of surveillance. Swedish police said officers followed a car rented by three of the suspects from Stockholm to the Danish border late Tuesday or early Wednesday.
Danish intelligence said the group had been planning to enter the building where the Jyllands-Posten daily has its Copenhagen newsdesk and "to kill as many of the people present as possible."
Security officials said the assault was to have been carried out some time before this weekend, and could have been similar to the 2008 terrorist attack in Mumbai, India, that left 166 people dead.
Danish intelligence said those arrested were a 26-year-old Iraqi asylum-seeker living in Copenhagen and the three Swedish residents who had rented the car: a 44-year-old Tunisian, a 29-year-old Lebanese-born man and a 30-year-old whose national origin was not immediately released. The Danish resident was arrested in a separate raid, in a different Copenhagen suburb, from the other three.
The four men face preliminary charges of attempting to carry out an act of terrorism. A custody hearing was scheduled for Thursday. Denmark police do not release the names of suspects.
In Sweden, police said they arrested a 37-year-old Swedish citizen of Tunisian origin living in Stockholm.
The Associated Press contributed to this report.