Peel onion and garlic and chop finely. Core the tomatoes and cut into small cubes. Drain the tuna in a colander.
Fry the onion and garlic cubes in a little olive oil in a pan until translucent. Tear up the drained tuna with a fork and add to the pan with the peas and diced tomatoes. Season with salt and pepper. Chop the basil and add it to the pan as well.
Cook the spaghetti in salted boiling water until al dente.
Add some of the pasta water to the tuna in the pan. Drain the pasta in a colander and mix with the tuna sauce.
Arrange on plates and sprinkle with grated cheese.