In Spanish media and common talk "Goverment" is just the executive branch ( https://en.wikipedia.org/wiki/Government_of_Spain ) . The Judiciary is part of the state and the administration but not of the goverment. This might lead to misleading translations on the international media.
Of course it is much more complicated but, in principal, the judiciary is an independent branch of the state. You gain access by passing an examination of your knowledge of the countries law and then the judiciary has its own separate internal elections in which they promote judges internally.
I am saying it is much more complex, because, for example, there are some positions inside the judiciary goverment in which the parliment and the senate has designating power. There is a branch of the judiciary that makes sure the law is being defended ( ministry of prosecution) and the chief of this is goverment appointed, although in theory must conduct himself independent of the political shenanigans sometimes it is not so.
Of course it is not perfect. In some ways is similar to the designation of Supreme Justices by the senate in the USA.
However, in principle, the judiciary is not part of what the spanish media and spanish speakers call the goverment.