The High Court has rejected BT and TalkTalk’s challenge of the Digital Economy Act 2010.
A judge rejected BT and TalkTalk claims that the Digital Economy Act 2010 was seriously flawed and "incompatible" with European law.
Supporters of the new laws said they were "delighted" and the ruling would be a major boost to people working in the creative industries whose livelihoods were being put at risk because their output was being stolen "on a daily basis".
BT and TalkTalk, two of the UK's largest internet service providers (ISPs), argued that measures introduced under the Act would unlawfully "impact on the privacy and free expression rights" of consumers.
They also challenged the legality of the statutory order, currently before Parliament in draft form, designed to regulate sharing the costs of implementing the new legislation.
But Mr Justice Parker, sitting at London's High Court, dismissed all the claims, except for one relating to the costs order, when he removed the ISP's obligation to pay 25 per cent of Ofcom's costs and the costs of establishing an appeals body.
A Department for Culture, Media and Sport spokesman said: "We are pleased that the court has recognised these measures as both lawful and proportionate.
"The Government remains committed to tackling online piracy and so will set out the next steps for implementation of the Digital Economy Act shortly."
The judge ruled Parliament had a wide area of discretion. He said it had been entitled to decide that the enhanced protection of copyright under the new legislation justified the likely costs of the new measures, taking into account the interests of internet service providers and internet users.
He upheld submissions made by lawyers for the Department for Culture, Media and Sport, who maintained the legislation was consistent with EU legislation and contained sufficient safeguards to protect the rights of consumers and ISPs.
The Government has stated its aim is to protect the UK's "creative economy" from the threat of online copyright infringement, which industry estimates costs £400 million a year.
BT and TalkTalk say the new law could potentially lead to millions of innocent customers having their privacy invaded.
Their lawyers argued in court that ISPs and consumers would face disproportionate costs. The new laws would "impact on privacy and free expression rights" and interfere with customer relationships.
The new legislation went through in the final days of the last Labour government.
The coalition decided not to repeal it and is now working on implementing elements of the Act.
A number of MPs and pressure groups voiced concern following the controversial Digital Economy Bill being given royal assent after just two hours of debate in the Commons.
The parliamentary inquiry into the protection of intellectual property (IP) rights online was suspended to await the outcome of the legal challenge, and the submission deadline for written evidence extended.
After today's ruling, a BT spokesman said: "We are disappointed with the outcome of the judicial review.
"We are reviewing this long and complex judgment. Protecting our customers is our number one priority and we will consider our options once we have fully understood the implications for our customers and businesses.
"This was always about seeking clarity on certain points of law and we have to consider whether this judgment achieves these aims."