HS2 Ltd said the injunction "...will not, and is not intended to, stop legitimate protest".
The order makes going onto HS2 land without permission or disrupting work a potential contempt of court - the offence of ignoring a judge's ruling.
It will not only apply to identified protestors but to "persons unknown".
HS2 welcomed the court judgement and said it was "not intended to stop legitimate protest".
A High Court judge sitting at Birmingham's Civil Justice Centre, Mr Justice Julian Knowles, said the injunction struck "a fair balance between the rights of the individual protestors and the general right and interests of HS2 and others who are being affected by the protests, including the national economy."
Legal experts say this court order is one of the most far-reaching of its kind in English legal history.
Opponents have argued it will stifle peaceful opposition and even hamper ecologists who need access to monitor the build.
Protests against the line have cost an estimated £122 million.
Mr Justice Knowles took more than four months to consider almost 8,000 pages of evidence, including plans, statements and maps.
The order covers a range of scenarios, including people "interfering with" access to the land or "delaying or hindering" any HS2 work.
Mr Justice Knowles said he was "satisfied that there has been significant violence, criminality and sometimes risk to the life of the activists, HS2 staff and contractors."
He added that, while he had "anxiously considered the geographical extent of the injunction along the whole of the HS2 route", he had decided that "such an extensive injunction is appropriate."
He said he had studied the land plans and found that "they are clear, detailed and precise. I reject any suggestion that they are unclear. They clearly show the land to which the injunction… will apply.
"I am satisfied that the trespass and nuisance will continue, unless restrained, and that the risk is both real and imminent."
Breaking the injunction would be a contempt of court, which can lead to jail.
An HS2 spokesperson said it would not be used to stop law-abiding protestors and said: "As Mr Justice Knowles makes clear, this injunction will not, and is not intended to, stop legitimate protest.
"Instead, we hope the injunction will prevent the violence, intimidation, and criminal damage these protests have frequently caused, harming the HS2 project and those working on it, and costing the UK taxpayer millions of pounds."
Ricardo Gama from the law firm Leigh Day said it was "definitely one of the biggest" injunctions ever sought.
He said the only comparable case was the injunction used to evict the Insulate Britain protestors, which applied across the whole of the strategic road network.
"It criminalises a future action in a much more clear-cut and draconian way than the criminal law does," said Mr Gama. "If there is a criminal offence, then there are safeguards in legislation and case law about what the offence constitutes and what the defence might be."
Anti-HS2 activist Mark Keir said there had been "no justice" and called the awarding of the injunction "a democracy-crippling decision" that was "deeply worrying".
Legal documents submitted to the court argued that: "Given the extent of the HS2 Land, the term has a clear chilling effect on all forms of protest against HS2.
"Some HS2 land passes through high-density urban areas with multiple roads and public highways... It also covers woodland and other areas with public access and public rights of way."
"Most of HS2 land is not subject to any physical demarcation or barrier... Notwithstanding the 283 pages of maps which have been produced, the breadth scope and complexity of the land subject to the proposed injunction is such that it is in practical terms not possible for persons to reliably ascertain the scope of the injunction."
The HS2 line passes through the Chiltern hills, where there are over 2,000 miles (3,219km) of footpaths.
According to the Chiltern Society, many have had to be diverted because of the construction, and there is a concern that walkers could mistakenly break the injunction and commit a criminal offence.
Keith Hoffmeister, a society volunteer said: "There is a danger that they set off on a nice walk across the countryside and start walking across a footpath that they might not even be aware is crossing HS2 land.
"If they strayed off that footpath there is the potential for them to be committing a criminal offence - and likewise with the footpath maintenance volunteers who may be straying offline in order to cutback hedges. They could easily stray off the footpath and again be prosecuted by HS2 for trespassing."
Matthew Stanton, head of planning and advocacy at Berks, Bucks & Oxon Wildlife Trust, said he was also worried volunteers and staff monitoring the impact of HS2's work on wildlife and their habitats might inadvertently find themselves wandering onto private land and falling foul of the injunction, if it were applied too strictly.
He said: "We are concerned about the impact the injunction will have on people's ability to monitor the work HS2 is doing in terms of ecological impact and that's because we have already had experiences where people feel intimidated going near HS2 land and we are concerned that security staff of HS2 will feel even more emboldened with such an injunction behind them.
"It's one thing trying to stop people having illegal camps on HS2 land but, if that is what HS2 wants, then just have an injunction that says that - don't have a catch-all injunction that basically means they can threaten to imprison anyone who even slightly affects their operations."
HS2 was originally meant to connect London with Birmingham, Manchester and Leeds. Work has already started on the first phase, linking London and the West Midlands. The next section will extend the line to Crewe. The final phase was to take HS2 to Manchester and Leeds. But the Leeds leg is being scrapped.
The government says HS2 will cut Birmingham to London journey times from one hour 21 minutes, down to 52 minutes.
The London and Birmingham leg was due to open at the end of 2026. But this is now expected between 2029 and 2033.
The second phase was due to open in 2032-33, but has been pushed back to 2035-2040.