The amount of ultraviolet irradiation and ablation experienced by a planet depends strongly on the temperature of its host star. Of the thousands of extrasolar planets now known, only six have been found that transit hot, A-type stars (with temperatures of 7,300-10,000 kelvin), and no planets are known to transit the even hotter B-type stars. For example, WASP-33 is an A-type star with a temperature of about 7,430 kelvin, which hosts the hottest known transiting planet, WASP-33b (ref. 1); the planet is itself as hot as a red dwarf star of type M (ref. 2). WASP-33b displays a large heat differential between its dayside and nightside, and is highly inflated-traits that have been linked to high insolation. However, even at the temperature of its dayside, its atmosphere probably resembles the molecule-dominated atmospheres of other planets and, given the level of ultraviolet irradiation it experiences, its atmosphere is unlikely to be substantially ablated over the lifetime of its star. Here we report observations of the bright star HD 195689 (also known as KELT-9), which reveal a close-in (orbital period of about 1.48 days) transiting giant planet, KELT-9b. At approximately 10,170 kelvin, the host star is at the dividing line between stars of type A and B, and we measure the dayside temperature of KELT-9b to be about 4,600 kelvin. This is as hot as stars of stellar type K4 (ref. 5). The molecules in K stars are entirely dissociated, and so the primary sources of opacity in the dayside atmosphere of KELT-9b are probably atomic metals. Furthermore, KELT-9b receives 700 times more extreme-ultraviolet radiation (that is, with wavelengths shorter than 91.2 nanometres) than WASP-33b, leading to a predicted range of mass-loss rates that could leave the planet largely stripped of its envelope during the main-sequence lifetime of the host star.