Cake:
2 1/4 cups unbleached all-purpose flour (11 1/4 ounces), plus extra for dusting pans
1 tablespoon ground cinnamon
3/4 teaspoon ground cardamom
1/2 teaspoon ground allspice
1/2 teaspoon ground cloves
1/4 teaspoon ground nutmeg
16 tablespoons unsalted butter (2 sticks), softened
1/2 teaspoon baking powder
1/2 teaspoon baking soda
1/2 teaspoon table salt
2 large eggs at room temperature
3 large egg yolks at room temperature
1 teaspoon vanilla extract
1 3/4 cups granulated sugar (12 1/4 ounces)
2 tablespoons light molasses or mild molasses
1 tablespoon grated fresh ginger
1 cup buttermilk , at room temperature
Frosting
5 tablespoons unsalted butter , cut into 5 pieces, softened
1 1/4 cups confectioners’ sugar (4 1/2 ounces)
8 ounces cream cheese , cut into 4 pieces , softened
1/2 teaspoon vanilla extract
3/4 cup coarsely chopped walnuts, toasted (optional)
For the cake: Adjust oven rack to middle position and heat oven to 350 degrees. Grease and flour 13- by 9-inch baking pan. Combine spices in small bowl; reserve 1/2 teaspoon for frosting.
2. Heat 4 tablespoons butter in 8-inch skillet over medium heat until melted, 1 to 2 minutes. Continue to cook, swirling pan constantly, until butter is light brown and has faint nutty aroma, 2 to 4 minutes. Add spices and continue to cook, stirring constantly, 15 seconds. Remove from heat and cool to room temperature, about 30 minutes.
3. Whisk flour, baking powder, baking soda, and salt in medium bowl. In small bowl, gently whisk eggs, yolks, and vanilla to combine. In standing mixer fitted with paddle attachment, cream remaining 12 tablespoons butter with sugar and molasses at medium-high speed until pale and fluffy, about 3 minutes, scraping down sides and bottom of bowl twice with rubber spatula. Reduce to medium speed and add cooled butter and spice mixture, ginger, and half of egg mixture; mix until incorporated, about 15 seconds. Repeat with remaining egg mixture; scrape down bowl again. Reduce to low speed; add about one-third flour mixture, followed by half of buttermilk, mixing until just incorporated after each addition, about 5 seconds. Repeat using half of remaining flour mixture and all of remaining buttermilk. Scrape bowl and add remaining flour mixture; mix at medium speed until batter is thoroughly combined, about 15 seconds. Remove bowl from mixer and fold batter once or twice with rubber spatula to incorporate any remaining flour.
4. Transfer batter to prepared pan; following illustrations at left, zigzag tip of metal spatula through batter, pulling it to pan edges. Lightly tap pan against counter 3 or 4 times to dislodge any large air bubbles; smooth surface with spatula.
5. Bake until toothpick inserted in center of cake comes out clean, 32 to 37 minutes. Cool cake to room temperature in pan on wire rack, about 2 hours.
6. For the frosting: In bowl of standing mixer fitted with paddle attachment, beat butter, sugar, and reserved 1/2 teaspoon spice mixture at medium-high speed until light and fluffy, 1 to 2 minutes. Add cream cheese one piece at a time, beating thoroughly after each addition. Add vanilla and beat until no lumps remain, about 30 seconds.
7. Run paring knife around edge of cake to loosen from pan. Using spatula, spread frosting evenly over surface of cake. Sprinkle cake with walnuts, if using. Cut into squares and serve.