Preheat the oven to 400°F. Line a baking sheet with parchment paper.
Peel and cube the sweet potato into 1/2-inch pieces. Toss the cubes with a drizzle of olive oil, salt, and pepper, then spread them evenly on the baking sheet.
Roast the sweet potatoes for about 20-25 minutes, until tender and lightly browned, stirring halfway through.
While the sweet potatoes roast, finely chop the pistachios in a food processor until they form a coarse crumb texture.
Season the cod fillet with salt, pepper, and a drizzle of lemon juice. Press the chopped pistachios onto the top of the cod to form an even crust.
Heat a non-stick skillet over medium heat and add a small splash of olive oil. Sear the cod, pistachio-side down, for about 2 minutes to help set the crust.
Transfer the cod to a baking dish and bake in the oven (with the sweet potatoes if space allows, or separately) for another 8-10 minutes until the fish is opaque and flakes easily with a fork.
For the garlicky spinach, heat a small pan over medium heat. Add the olive oil and lightly sauté the minced garlic for about 30 seconds until fragrant.
Add the fresh spinach to the pan and toss quickly until just wilted, about 2 minutes. Season with a pinch of salt and a dash of lemon juice.
Plate the pistachio-crusted cod alongside the roasted sweet potatoes and garlicky spinach. Serve immediately.