The fact that you are a nonresident alien for US tax purposes for the first few years is based purely on US rules, and does not involve a tax treaty at all. See Publication 519 for more details on who is a resident alien and who is not.
If you are in student status, including as a J-1 student, you are an exempt individual (i.e. days in student status in that year not counting in the Substantial Presence Test), unless you have been an exempt individual for any part of 5 previous calendar years. If you are any type of J-1 other than student, you are a "teacher or trainee", and you are an exempt individual unless you have been an exempt individual for some part of 2 of the previous 6 calendar years. Note that any part of a calendar year counts as one calendar year, so even if you arrived on December 31 of a given year, that year counts as one of the calendar years for which you were an exempt individual.
You did not state which type of J-1 you have, so I can't tell which of these two rules apply to you. You also have not stated when you arrived in J-1 status, and whether you had ever been in F or J status before that. If you are an exempt individual for your whole time in the US in a given year, I don't think there is any way for you to choose to be treated as a resident alien, unless you are married to a US citizen or resident alien for tax purposes. Again, this treatment does not come from a tax treaty, so "waiving tax treaty rights", even if that were possible, would not help you.
Note that being a nonresident alien does not mean you don't get taxed in the US -- nonresident aliens are still taxed on US-source income, and if you are performing work while in the US, the income from that work is US-sourced, and thus taxed by the US (federal and state), unless exempted by a tax treaty. If Spain considers you a tax resident, it will tax that income too, and then you can claim a foreign tax credit in Spain on the doubly-taxed income. The amount of the credit will be equal to the lesser of the two taxes, and so the net effect is that the total amount of taxes you pay will be equal to the higher of the two taxes (which in your case is the Spanish tax). So the effect is the same as you expected (the total amount of tax paid is equal to the Spanish tax), but the reason is not as you expected (it's not because you are not subject to US tax, but you will pay part of it to the US and the remainder to Spain).