Pathogenic coronaviruses represent a major threat to global public health. Here, using a recombinant reporter virus-based compound screening approach, we identified several small-molecule inhibitors that potently block the replication of the newly emerged severe acute respiratory syndrome virus 2 (SARS-CoV-2). Among them, JIB-04 inhibited SARS-CoV-2 replication in Vero E6 cells with an EC50 of 695 nM, with a specificity index of greater than 1,000. JIB-04 showed in vitro antiviral activity in multiple cell types against several DNA and RNA viruses, including porcine coronavirus transmissible gastroenteritis virus. In an in vivo porcine model of coronavirus infection, administration of JIB-04 reduced virus infection and associated tissue pathology, which resulted in improved weight gain and survival. These results highlight the potential utility of JIB-04 as an antiviral agent against SARS-CoV-2 and other viral pathogens.