You can do this with a single exposure. Use a longish shutter speed to expose the background and the flash to properly expose and freeze your subject. You'll likely need to have your camera on a tripod or other stable support, such as a table. This technique is often referred to as 'dragging the shutter' or 'slow shutter sync'.
Most cameras will default to slow shutter sync if the camera is set to Aperture Priority (Av) exposure mode and a TTL flash is detected on the hot shoe when the ambient light is below a specific brightness level.
Many cameras have a built in scene mode that automatically does this. Canon and Nikon both call it Night Portrait Mode. Olympus calls it Night Scene Mode. Others have similar names for it.
For the ultimate in control, use Manual exposure mode and manual flash. Set the ISO, aperture (Av), and shutter time (Tv) for the ambient light in the background, then set the flash power to properly illuminate your subject in the foreground with the selected ISO, Av, and Tv. Getting the flash off camera and using a flash modifier to soften the light from the flash will also help, as will gelling the flash to match the ambient lighting.
What is the difference between 'P' mode vs. the scene modes?
Why isn't aperture priority mode automatically adjusting the shutter speed on my Nikon?