Bring a large pot of salted water to a boil. Add spaghetti and cook until al dente, 9 minutes. Drain, reserving ½ cup of the cooking liquid.
Put pesto in a large bowl. Scoop avocado flesh into bowl and mash avocado and lemon juice into pesto.
Toss spaghetti with pesto, adding some of the reserved cooking liquid if necessary to give it the desired consistency.
Serve spaghetti with sliced tomatoes.