Spoken Spanish is not so close to Portuguese. The range of sounds of Portuguese is wider than Spanish’s. Some say that Portuguese sounds like a slavic language sometimes.
So written Portuguese is closer to Spanish than Italian. But in spoken language is probably the other way. Italian sounds closer to Spanish.