Yes, you can buy mortgage term life insurance protection to provide the funds needed for you to payoff the mortgage on your home upon your spouse's death.
The insurance will be on your spouse - who will be the insured person on the life insurance policy. You will be named as the beneficiary of the plan.
You'll want to choose a term (duration) of coverage that matches the length of time you have remaining on your mortgage.
In additino, you should choose an amount of life insurance equal to the amount you owe on your loan.
That way, you have protection in the amount needed, for the duration of your mortgage. If you spouse dies, you will have the money needed to remain in your home.
Learn more about insurance to pay off your home if your spouse passes away.