The regional federal court ruled work on Belo Monte hydro-electric dam across the Xingu River should be immediately suspended pending a hearing.
When the project was approved in 2005, the National Congress only called for an environmental impact study after work had started.
Under the law, native communities were given the right to air their views on the basis of that study, but this was not done.
The court noted that the Norte Energia consortium in charge of the project will be able to appeal the decision to a higher court.
Norte Energia said it was awaiting formal notification of the ruling before responding.
It could be liable for a $250,000 (about £160,000) daily fine if it flouts the order.
Work on the dam began a year ago, despite fierce opposition from local people and green activists.
Indigenous groups fear the dam will harm their way of life while environmentalists have warned against deforestation, greenhouse gas emissions and irreparable damage to the ecosystem.
Belo Monte is expected to flood an area of 200 square miles along the Xingu and displace 16,000 people, according to the government.
The federal government plans to invest a total $1.2bn (£0.7bn) to assist the displaced, by the time the dam is completed in 2019.