The legislation, which was pushed through by parliament Wednesday, was approved by 55 senators, with 23 opposed and two abstentions.
During the 15-hour debate thousands of demonstrators took to the streets nationwide to protest the law, which reinforces political control over the Supreme Court.
After the vote, protesters gathered in front of parliament shouting “Shame!” “Traitors!” and “Democracy!”.
The reform of the Supreme Court, which supervises lower courts, still needs to be signed by President Andrzej Duda, himself from the ruling conservative Law and Justice (PiS) party, to become law.
The head of state has 21 days to sign the document, veto it, or, if in doubt, submit it to the constitutional court.
The opposition and protesters are all calling on Duda to veto the reform, as well as two other measures recently adopted which they say increase the control of the executive branch of government over the judiciary.
The opposition argues the measures amount to a “coup d’etat” but the PiS says the reforms are essential to rationalise the judicial system and fight corruption.
The PiS, which began making judiciary changes after coming to power in late 2015, has argued resistance to the initiatives is a case of the elite defending their privileges.
Under the current system, candidates for the Supreme Court are selected by an independent body consisting mainly of judges but also included a few politicians.
The European Commission has warned against the changes, threatening to halt Poland’s voting rights in the 28-nation bloc further down the line — a so-called “nuclear option” that the EU had never invoked.
The EU first warned Poland in early 2016 over reforms of the constitutional court, whose main role is to check that laws comply with the constitution.
Those changes resulted in tilting the makeup of the court in the conservatives’ favour and installing a PiS ally as the chief justice.
While noting that Poland was a close ally of Washington, the US State Department said America was concerned by the legislation, according to a statement.
Last week, both houses of parliament adopted two other contested pieces of judicial legislation, including a bill stating that the justice minister will name the chief justices of Poland’s common courts.
The second bill stipulates that from now on the parliament, instead of an independent body, will choose the members of the National Council of the Judiciary, which is meant to protect the independence of the courts.