Fry the garlic and onions in a large saucepan in the hot olive oil. Roughly chop the spinach leaves, add and steam for about 5 minutes. Scald the tomatoes, peel and core them and cut into cubes. Add tomatoes and corn to the spinach and simmer for about 5 minutes, season with salt and pepper.
In the meantime, cook the gnocchi in plenty of salted water until al dente. Drain the gnocchi, add to the vegetables and heat briefly. Serve sprinkled with cheese.