Another solution would be to use an ordered list.
$my_query = new WP_Query($args);
if ( $my_query->have_posts() ) :
echo '<ol style="list-style:decimal">';
while( $my_query->have_posts() ) : $my_query->the_post();
echo '<li><a href="' . get_permalink( get_the_ID() ) . '">' . get_the_title() . '</a></li>';
endwhile;
echo '</ol>';
endif;