China formally arrested an Australian writer on alleged national-security grounds, his lawyers said, advancing a case that has added to tense relations between Beijing and Australia.

Yang Hengjun, a blogger and spy novelist who had been in custody for the past half-year, was formally placed under criminal detention on Wednesday by Beijing’s state-security bureau on charges of “endangering national security,” his lawyers said Thursday.

The...