Minecraft wiki entry for Spawn-proofing, associated text: Light blocks
One of the most basic ways to prevent mob spawning is by placing torches. These will increase the light level around them, stopping hostiles from spawning. Other blocks such as glowstone or shroomlight emit higher light levels, but are harder to come by. This method does not work with mobs whose spawning does not rely on low light level, such as slimes, magma cubes and hoglins.