The Somerset opener had previously scored just one run in two innings but his unbeaten half century helped England secure a draw in the tour match.
Compton believes that his display was an important confidence boost and gives him a fighting chance of being picked for the first test against India.
He told BBC Sport: "For me it was just very important to get back into that mindset of scoring runs, spending time in the middle.
"Today I just felt that my balance was lot better, my leaving was lot more assured and I played the balls I had to.
"I'd be lying if I said I didn't have an eye on the that opening spot and I've been working really hard towards that."