Toast the pine nuts. Heat a small dry skillet over medium heat and toast the pine nuts for 3–5 minutes, stirring frequently, until lightly golden and fragrant. Let cool.
Blend the ingredients. Add the basil, toasted pine nuts, garlic, Parmesan, flaky sea salt, and black pepper (if using) to a food processor. Pulse until finely chopped.
Add the olive oil. With the food processor running, slowly drizzle in the olive oil until the pesto is smooth and creamy, stopping to scrape down the sides as needed.
Finish the pesto. Add the lemon juice, if using, and pulse a few more times to combine. Taste and adjust with additional salt, pepper, Parmesan, or lemon juice as needed.
Serve. Toss with hot pasta, spread onto sandwiches, spoon over grilled vegetables or meats, or use as a dip or spread.