Cook the spaghetti according to package instructions in a large pot of salted boiling water until al dente. Reserve 1/2 cup of pasta water, then drain the pasta and set aside.
In a large skillet, heat the olive oil over medium heat. Add the minced garlic and sauté for about 30 seconds until fragrant.
Add the sliced zucchini to the skillet and cook for 3-4 minutes, stirring occasionally, until slightly softened.
Stir in the cherry tomatoes and dried oregano. Cook for an additional 3-5 minutes until the tomatoes start to soften and release their juices.
Toss the cooked pasta into the skillet with the zucchini and tomatoes. If the mixture seems dry, add a little reserved pasta water to reach your desired consistency. Season with salt and pepper to taste.
Remove from heat and sprinkle with grated Parmesan cheese if using. Toss to combine.
Serve immediately, garnished with fresh basil leaves if desired.