Cook the spaghetti al dente. While cooking, heat the tomatoes in the spaghetti water so that the peel comes off more easily.
Peel the tomatoes and cut into pieces. Drain the spaghetti water, add olive oil and tomato pieces to the pasta and simmer everything over low heat. Add the mozzarella in small pieces while stirring and allow to melt.
Cut the ham into strips and add them as well. Finally fold in the basil leaves and season the dish with salt and pepper.