Dice onion and sauté for about five minutes. Set aside.
Brown ground beef and drain excess grease.
Add onions and spaghetti sauce to ground beef. Add mushrooms, if desired. Bring to simmer. Cook for 30 minutes.
While sauce is simmering, cook spaghetti according to package directions.
Spray a 9×13 inch pan with cooking spray. Make a layer of cooked spaghetti in bottom of pan, add a layer of meat sauce, then a layer of cheese. Repeat.
Bake at 350 degrees for 20 minutes until cheese is melted.