Cognitive processes, such as stimulus appraisal, are important in generating emotional states and successful coping with cognitive challenges is thought to induce positive emotions. We investigated learning behaviour and autonomic reactions, including heart rate (HR) and its variability (standard deviation (SDNN) and root mean square of successive differences (RMSSD) of a time series of interbeat intervals). Twenty-four domestic pigs, Sus scrofa, housed in six groups of four, were confronted with a cognitive challenge integrated into their familiar housing environment. Pigs were rewarded with food after they mastered the discrimination of an individual acoustic signal followed by an operant task. All pigs quickly learned the tasks, while baseline SDNN and RMSSD increased significantly throughout the experiment. In reaction to the signals, pigs showed a sudden increase in HR, SDNN and RMSSD, and a decrease in the RMSSD/SDNN ratio. Immediately after this reaction, the HR and SDNN decreased, and the RMSSD/SDNN ratio increased. During feeding, the HR and the RMSSD/SDNN ratio stayed elevated. The pigs showed no cardiac reaction to the sound signals for other pigs or their feeding pen mates. We concluded that the level of cognitive challenge was adequate and that the observed changes in the autonomic tone, which are related to different dimensions of the affective response (e.g. arousal and valence), indicated arousal and positive affective appraisal by the pigs. These findings provide valuable insight into the assessment of positive emotions in animals and support the use of an adequate cognitive enrichment to improve animal welfare.