Mix the dry ingredients: In a small bowl, whisk together the flour, baking powder, and salt. Set this aside so you don't accidentally dump it into your butter later.
Cream the butter and sugar: Using an electric mixer on medium-high speed, beat the softened butter and granulated sugar together for about 3 to 4 minutes. You want to see the mixture become very pale yellow and fluffy; this incorporates air which gives the cookies their tender texture.
Add wet ingredients: Add the eggs one at a time, beating well after each addition until fully incorporated. Scrape down the sides of the bowl with a spatula to make sure nothing is stuck to the bottom. Mix in the vanilla extract.
Incorporate flour gradually: Switch your mixer to low speed. Add the flour mixture in three separate additions, mixing just until the dough comes together and no dry streaks remain. Do not overmix at this stage, or the cookies will become tough.
Chill the dough: Shape the dough into a disc, wrap it tightly in plastic wrap, and refrigerate for at least 1 hour (or up to 2 days). This step is crucial; it relaxes the gluten and keeps the cookies from spreading too much in the oven.
Preheat and prep: Preheat your oven to 350°F (175°C). Line two baking sheets with parchment paper or silicone mats.
Scoop and bake: Using a 2-tablespoon scoop, portion the dough into balls. Roll them gently in your hands to smooth out any cracks. Place them on the prepared baking sheets, spacing them about 2 inches apart. Bake for 10 to 12 minutes. They are done when the edges just barely start to turn light golden brown, but the centers still look slightly soft and underbaked.
Cool completely: Transfer the cookies to a wire rack and let them cool completely before handling. This might take 30-45 minutes, but it is essential for the best texture.
Assemble the Alfajores: Once the cookies are room temperature, spread a generous layer of dulce de leche onto the flat side of one cookie. Immediately cap it with another cookie and press down gently to seal. Repeat with the remaining dough and filling.
Finish and serve: If desired, dust the tops lightly with powdered sugar or sprinkle with crushed wafers right before serving.