Bactrocera frauenfeldi (Schiner) (Diptera: Tephritidae) is a polyphagous fruit fly pest species that is endemic to Papua New Guinea and has become established in several Pacific Islands and Australia. Despite its economic importance for many crops and the key role of chemical-mediated sexual communication in the reproductive biology of tephritid fruit flies, as well as the potential application of pheromones as attractants, there have been no studies investigating the identity or activity of rectal gland secretions or emission profiles of this species. The present study (1) identifies the chemical profile of volatile compounds produced in rectal glands and released by B. frauenfeldi, (2) investigates which of the volatile compounds elicit an electroantennographic or electropalpographic response, and (3) investigates the potential function of glandular emissions as mate-attracting sex pheromones. Rectal gland extracts and headspace collections from sexually mature males and females of B. frauenfeldi were analysed by gas chromatography-mass spectrometry. Male rectal glands contained (E,E)-2-ethyl-8-methyl-1,7-dioxaspiro [5.5]undecane as a major component and (E,E)-2,8-dimethyl-1,7-dioxaspiro[5.5]undecane as a moderate component. Minor components included palmitoleic acid, palmitic acid, and ethyl oleate. In contrast, female rectal glands contained (E,E)-2,8-dimethyl-1,7-dioxaspiro[5.5]undecane and ethyl laurate as major components, ethyl myristate and ethyl palmitoleate as moderate components, and 18 minor compounds including amides, esters, and spiroacetals. Although fewer compounds were detected from the headspace collections of both males and females than from the gland extractions, most of the abundant chemicals in the rectal gland extracts were also detected in the headspace collections. Gas chromatography coupled electroantennographic detection found responses to (E,E)-2,8-dimethyl-1,7-dioxaspiro[5.5]undecane from the antennae of both male and female B. frauenfeldi. Responses to (E,E)-2-ethyl-8-methyl-1,7-dioxaspiro[5.5]undecane were elicited from the antennae of females but not males. The two spiroacetals also elicited electropalpographic responses from both male and female B. frauenfeldi. Ethyl caprate and methyl laurate, found in female rectal glands, elicited responses in female antennae and palps, respectively. Y-maze bioassays showed that females were attracted to the volatiles from male rectal glands but males were not. Neither males nor females were attracted to the volatiles from female rectal glands. Our findings suggest (E,E)-2,8-dimethyl-1,7-dioxaspiro[5.5]undecane and (E,E)-2-ethyl-8-methyl-1,7-dioxaspiro[5.5]undecane as components of a sex-attracting pheromone in B. frauenfeldi.