Melt butter in a small frying pan over medium-high heat. Saute the onion in butter until soft. Mash up the spam with a fork then add it to the frying pan. Cook for 2 or 3 minutes, until browned. Pour the egg into the frying pan so that it covers all of the meat and onion. Cook until firm, then flip to brown the other side.
Place the egg and meat onto one slice of the bread and top with cheese and tomato if desired. Place the other piece of bread on top. Bread can also be toasted first.