A magnified compact galaxy at redshift 9.51 with strong nebular emission lines