It would be important to know where you are a citizen and where you are resident.
I can tell you right off that you will have to report the sale of teh US real property . Of course if you are citizen or resident alien of the US and this was yoru main home for 2 out of the last 5 years, you will be allowed to Exclude up to $250,000 (if single) of the gain on the sale for US tax purposes.
If you reside more than six months per year in Spain, you are considered a tax resident. You would be allowed to use the tax treaty though between the US and Spain so you would not be doubley taxed.
1. Gains derived by a resident of a Contracting State from the alienation of real property situated in
the other Contracting State may be taxed in that other State
Even if you are resident in Spain your US tax woudl not be eliminated.
Under the double taxation agreement in the treaty:
(a) Where a resident of Spain derives i
ncome which, in accordance with the provisions
of this Convention, may be taxed in the United States, other than solely by reason of citizenship,
Spain shall allow as a deduction from the tax on the income of that resident an amount equal to
the income tax actually paid in the United States.