The U.S. Marshals Service says the victims included a deputy U.S. marshal and a court security officer. The 48-year-old deputy marshal was hospitalized, and the 65-year-old security officer died.
FBI Special Agent Joseph Dickey said the gunman died across the street shortly after the shootout. The man's identity and motive were not immediately known.
Authorities believe the shooter acted alone, Chief Deputy U.S. Marshal Roxanna Lea Irwin said.
The building was evacuated, police and news helicopters circled overhead, and Las Vegas police cordoned off the area for several blocks. A 16-story state and local courthouse two blocks away was locked down as a precaution.
After police arrived, paramedics wheeled at least two people out and down a ramp to ambulances.
Dickey called the building evacuation "standard procedure" in such an incident, and said it was "for the safety of everybody in the place."
Las Vegas police spokeswoman Barbara Morgan said the shooter had been shot in the head.
"It looks like he went in there and just started unloading," Morgan said.
The Lloyd D. George U.S. Courthouse and Federal Building is named for a longtime senior federal judge who still hears cases. It has federal courts and offices for federal officials including U.S. Sens. Harry Reid and John Ensign. Neither were in the building at the time, authorities said.
Irwin said she saw shotgun casings on the floor of the federal building lobby.