WASHINGTON—The American Federation of Government Employees said Thursday it has won the right to represent more than 40,000 airport-security screeners employed by the federal government, months after the Obama administration cleared the way for the workers to organize.

The screeners, who work for the Transportation Security Administration, chose the AFGE in a runoff vote against the National Treasury Employees Union by a margin of 8,903 to 8,447 votes. The vote began May 23 and ended Tuesday. In a previous vote tallied in...