Fill a large pot of water about 2/3 full of water (enough to cover your squash, but not overflow). Bring to a boil on the stove top.
Slice the spaghetti squash down the middle and scoop out the seeds. When the water boils, add the squash halves and boil for 15-20 minutes, or until the squash is cooked and it's easy to insert a fork into the flesh. Remove from the boiling water and set aside to cool.
In a medium sized skillet, heat the olive oil over medium heat. Add the crushed garlic cloves and cook for about 30 seconds.
Add the drained tomatoes and olives to the pan. Stir to combine and cook for 3 minutes.
Add the white beans, lemon juice and red pepper flakes, if using. Stir to combine and cook until heated through.
Use a fork to scrape the spaghetti squash strands out of the skins. Serve, either by placing a serving of squash in a bowl and adding some of the puttanesca topping (as shown) or by combining the squash with the sauce.