If you are married to a NRA then you have to file a 1040 and spouse has to file a 1040NR. You may not want to do this. You can file a 1040 joint if you want to:
You must be married,
One spouse has to be a US citizen or resident. The other is NRA.
An election is made. You can't claim that you are not a US tax resident to claim any Treaty benefits. Must file joint in year of election, but can file separate going forward.