Taxes for selling property in Spain?

Hello, I am a Spanish citizen, but US resident (green card). I live and I pay my taxes in the US, and this circumstance is not going to change anytime soon. I'm selling an apartment in Spain, that I own along my four brothers. The buyer has to retain 3% of my part for the Tax authorities in Spain. My part will amount to less than 200k. Please note that there is a double taxation agreement between the USA and Spain. Two questions: 1) Where do I declare my capital gains? Any information I find online gives me a sided answer: sites from Spain will tell me I have to declare my capital gains over there, even if I'm not a resident there, while sites from the US will tell me otherwise. 2) If I must declare my capital gains in the US (as logic would dictate), what will happen to the 3% retained by the Spanish Taxes? Thank you for your time, Rafael