Yes, transit purposes you can
for a week holiday in Spain beforhand would probably not be considered transit
but changing a plane in Spain to Germany would pose no problem with a D-Visa.
Border Code Article 6
Entry conditions for third-country nationals
By way of derogation from paragraph 1:
(a) third-country nationals who do not fulfil all ...
In my experience (with over 6 multiple entry schengen visa's with Sri Lankan passport), the more you traveled to and out of the schengen zone the higher the chance of applying and getting a long term visa. I visited my gf in Budapest so many times, and actually ended up getting a residence permit for "other purpose" by showing our bank accounts, employment ...
Generally speaking, Schengen visa with long validity and multiple entries are given after a few visits on shorter, single-entry visa without overstays or incidents. Your previous Italian visa should count in your favor.
It might become problematic if your ties to your place of residence (the UK) become weak.
You will need to apply at the embassy/consulate of the country which is your primary destination.
From the EU website:
You must lodge the application for a Schengen visa at the Consulate of the country that you intend to visit, or – if you intend to visit more than one Schengen State, the Consulate of the country where you will spend the longest period.