The iPhone Dev Team released PwnageTool 4.01 the day after iOS 4 was released. This Mac-only jailbreak tool works for the iPhone 3G, iPhone 3GS (old bootrom), and iPod Touch 2G by creating a custom firmware to install.
What about Windows users wanting to jailbreak iOS 4 with the same devices? The answer is with Sn0wbreeze, which has been updated and released by the efforts of iH8sn0w. If you have used Spirit to previously jailbreak your devices, stay away from Sn0wbreeze. Those with the new bootrom looking to jailbreak iOS 4 will have to continue to wait patiently.
As always, it is at your own risk to attempt the use of these tools. Please research diligently and backup your iPhone before proceeding.